diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b778e174f..1c3446fd4e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,8 +253,10 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO ## Process the Rpm install/remove scripts to update the CPACK variables configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/post.in" RPM/post @ONLY ) +configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/preun.in" RPM/preun @ONLY ) configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/postun.in" RPM/postun @ONLY ) set ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/post" ) +set ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/preun" ) set ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/postun" ) #Set the names now using CPACK utility diff --git a/RPM/postun.in b/RPM/postun.in index 72f4c565e2..d54cd9b2ea 100755 --- a/RPM/postun.in +++ b/RPM/postun.in @@ -4,6 +4,3 @@ if [ $1 -le 1 ] && [ "@ENABLE_LDCONFIG@" == "ON" ]; then rm -f /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf ldconfig fi - -# remove pyc file generated by python -rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rocm_smi/__pycache__ diff --git a/RPM/preun.in b/RPM/preun.in new file mode 100755 index 0000000000..33acd7f401 --- /dev/null +++ b/RPM/preun.in @@ -0,0 +1,5 @@ +if [ $1 -le 1 ]; then + # perform the below actions for rpm remove($1=0) or upgrade($1=1) operations + # remove pyc file generated by python + rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rocm_smi/__pycache__ +fi