From dde53a5200a0f692875bbd03c815ec097a0052a2 Mon Sep 17 00:00:00 2001 From: liuxueli Date: Mon, 29 Jun 2020 10:17:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4preInstall=E5=92=8CpreUninsta?= =?UTF-8?q?ll=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++-- cmake/PreInstall.sh | 19 +++++++++++++++++++ cmake/PreUninstall.sh | 9 +++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 cmake/PreInstall.sh create mode 100644 cmake/PreUninstall.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 71c5570..7d02c09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,8 @@ set(CMAKE_INSTALL_PREFIX /home/mesasoft/sapp_run) add_subdirectory(src) -SET(CPACK_RPM_LIBRARY_PRE_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/install.sh") -SET(CPACK_RPM_LIBRARY_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/uninstall.sh") +SET(CPACK_RPM_LIBRARY_PRE_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/cmake/PreInstall.sh") +SET(CPACK_RPM_LIBRARY_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/cmake/PreUninstall.sh") set(CPACK_RPM_LIBRARY_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/main.conf" "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/maat.conf" diff --git a/cmake/PreInstall.sh b/cmake/PreInstall.sh new file mode 100644 index 0000000..b944fc8 --- /dev/null +++ b/cmake/PreInstall.sh @@ -0,0 +1,19 @@ +DST=${RPM_INSTALL_PREFIX} + +mkdir -p ${DST}/plug/platform/ +mkdir -p ${DST}/etc/ +touch ${DST}/plug/conflist.inf +touch ${DST}/etc/project_list.conf + +if [[ -z `grep -rn 'POLICY_PRIORITY' ${DST}/etc/project_list.conf` ]];then + echo 'POLICY_PRIORITY struct' >> ${DST}/etc/project_list.conf +fi + +if [[ -z `grep -rn 'TSG_MASTER_INTERNAL_LABEL' ${DST}/etc/project_list.conf` ]];then + echo 'TSG_MASTER_INTERNAL_LABEL struct' >> ${DST}/etc/project_list.conf +fi + +if [[ -z `grep -rn 'tsg_master.inf' ${DST}/plug/conflist.inf` ]];then + sed -i '/\[platform\]/a\./plug/platform/tsg_master/tsg_master.inf' ${DST}/plug/conflist.inf +fi + diff --git a/cmake/PreUninstall.sh b/cmake/PreUninstall.sh new file mode 100644 index 0000000..96abc6f --- /dev/null +++ b/cmake/PreUninstall.sh @@ -0,0 +1,9 @@ +if [ $1 == 0 ]; then + DST=${RPM_INSTALL_PREFIX} + + mkdir -p ${DST}/plug/platform/ + sed -i '/tsg_master.inf/d' ${DST}/plug/conflist.inf + sed -i '/POLICY_PRIORITY/d' ${DST}/etc/project_list.conf + sed -i '/TSG_MASTER_INTERNAL_LABEL/d' ${DST}/etc/project_list.conf +fi +