Bläddra i källkod

HPCC-22547 Prerm changes for ensuring components stopped

Signed-off-by: Michael Gardner <michael.gardner@lexisnexisrisk.com>
Signed-off-by: Michael Gardner <michael.garder@lexisnexisrisk.com>
Signed-off-by: Michael Gardner <michael.gardner@lexisnexisrisk.com>

HPCC-22547 Updating other installation scripts to use configure_file

Signed-off-by: Michael Gardner <michael.gardner@lexisnexisrisk.com>
Michael Gardner 5 år sedan
förälder
incheckning
dd9867d6f1

+ 2 - 8
initfiles/bash/etc/init.d/uninstall-init.in

@@ -36,14 +36,8 @@ removeSymlink ()
     fi
 }
 
-/etc/init.d/hpcc-init stop
-/etc/init.d/dafilesrv stop
-
-if which systemctl 1>/dev/null 2>&1; then
-	if [ -e /etc/systemd/system/hpccsystems-platform.target ]; then
-		systemctl stop hpccsystems-platform.target
-        removeSymlink "/etc/systemd/system/hpccsystems-platform.target"
-    fi
+if [ -e /etc/systemd/system/hpccsystems-platform.target ]; then
+  removeSymlink "/etc/systemd/system/hpccsystems-platform.target"
 fi
 
 echo ""

+ 2 - 5
initfiles/bash/sbin/deb/CMakeLists.txt

@@ -14,8 +14,5 @@
 #    limitations under the License.
 ################################################################################
 
-SET(outFiles)
-GENERATE_BASH(processor ${bash-vars} "postinst.in" outFiles)
-GENERATE_BASH(processor ${bash-vars} "postrm.in" outFiles)
-ADD_CUSTOM_TARGET(ProcessFiles-initfiles-bash-sbin-deb ALL DEPENDS ${outFiles})
-
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/postinst.in" "${CMAKE_CURRENT_BINARY_DIR}/postinst" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/postrm.in" "${CMAKE_CURRENT_BINARY_DIR}/postrm" @ONLY)

+ 1 - 3
initfiles/bash/sbin/deb/postinst.in

@@ -15,8 +15,6 @@
 #    limitations under the License.
 ################################################################################
 
-###<REPLACE>###
-
-${INSTALL_DIR}/etc/init.d/install-init
+@INSTALL_DIR@/etc/init.d/install-init
 
 exit 0

+ 6 - 8
initfiles/bash/sbin/deb/postrm.in

@@ -15,14 +15,12 @@
 #    limitations under the License.
 ################################################################################
 
-###<REPLACE>###
-
 # Restore install link if it was present
 #######################
 linkf=/tmp/.hpccinslink
 if [[ -f ${linkf} ]] ; then
-   if [[ -n ${INSTALL_DIR} ]] ; then
-      if [[ ! -d ${INSTALL_DIR} ]] ; then
+   if [[ -n @INSTALL_DIR@ ]] ; then
+      if [[ ! -d @INSTALL_DIR@ ]] ; then
          linkinfo=$(cat "${linkf}")
          if [[ -n ${linkinfo} ]] ; then
             ln -s ${linkinfo}
@@ -38,10 +36,10 @@ fi
 #
 # If the install dir is still present post-removal, must be an update
 
-if [ -f "${INSTALL_DIR}/etc/init.d/install-init" ]; then
-    ${INSTALL_DIR}/etc/init.d/install-init
+if [ -f "@INSTALL_DIR@/etc/init.d/install-init" ]; then
+    @INSTALL_DIR@/etc/init.d/install-init
 else
-   [ -d ${INSTALL_DIR}/sbin ] && rm -rf  ${INSTALL_DIR}/sbin
-   [ -d ${INSTALL_DIR}/bin ] && rm -rf  ${INSTALL_DIR}/bin
+   [ -d @ADMIN_PATH@ ] && rm -rf  @ADMIN_PATH@
+   [ -d @EXEC_PATH@ ] && rm -rf  @EXEC_PATH@
    exit 0
 fi

+ 2 - 4
initfiles/sbin/CMakeLists.txt

@@ -30,11 +30,9 @@ GENERATE_BASH(processor ${bash-vars} "remote-install-engine.sh.in" outFiles)
 GENERATE_BASH(processor ${bash-vars} "deploy-java-files.sh.in" outFiles)
 GENERATE_BASH(processor ${bash-vars} "check-component-exists.sh.in" outFiles)
 
-SET(noInstall)
-GENERATE_BASH(processor ${bash-vars} "prerm.in" noInstall)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/prerm.in" "${CMAKE_CURRENT_BINARY_DIR}/prerm" @ONLY)
 
-
-ADD_CUSTOM_TARGET(ProcessFiles-initfiles-sbin ALL DEPENDS ${outFiles} ${noInstall})
+ADD_CUSTOM_TARGET(ProcessFiles-initfiles-sbin ALL DEPENDS ${outFiles})
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/regex.awk.in.cmake" "${CMAKE_CURRENT_BINARY_DIR}/regex.awk")
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/backup.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/backup.sh" @ONLY)
 

+ 11 - 12
initfiles/sbin/prerm.in

@@ -15,8 +15,6 @@
 #    limitations under the License.
 ################################################################################
 
-###<REPLACE>###
-
 # Checking if configmgr is still running
 ########################################
 configmgr_status=`ps -ef | grep 'configmgr' | grep -cE '(python|bash)'`
@@ -28,34 +26,35 @@ fi
 # Stop all services before cleaning up
 ######################################
 if which systemctl 1>/dev/null 2>&1; then
-	systemctl stop hpccsystems-platform.target
+    systemctl stop hpccsystems-platform.target
 else 
-	/etc/init.d/hpcc-init stop
-	/etc/init.d/dafilesrv stop
+	@CONFIG_DIR@/hpcc-init stop
+	@CONFIG_DIR@/dafilesrv stop
 fi
+killall -9 -u @RUNTIME_USER@
 
 # Remove edits from /etc files
 ##############################
-${INSTALL_DIR}/sbin/rm_conf_settings.sh
+@ADMIN_PATH@/rm_conf_settings.sh
 
 
 # Remove symlinks
 #################
-${INSTALL_DIR}/etc/init.d/uninstall-init
+@INSTALL_DIR@/etc/init.d/uninstall-init
 
 # Remove installed flag
 #######################
-if [ -f ${CONFIG_DIR}/installed ] ; then
-    rm ${CONFIG_DIR}/installed
+if [ -f @CONFIG_DIR@/installed ] ; then
+    rm @CONFIG_DIR@/installed
 fi
 
 # Check if install dir is a link
 #######################
-if [[ -n ${INSTALL_DIR} ]] ; then
+if [[ -n @INSTALL_DIR@ ]] ; then
 #  trim for readlink
-   ins_dir=$(echo "${INSTALL_DIR}" | sed 's/\/*$//')
+   ins_dir=$(echo "@INSTALL_DIR@" | sed 's/\/*$//')
    if [[ -h ${ins_dir} ]] ; then
-       echo "$(readlink "${ins_dir}") ${INSTALL_DIR}" > /tmp/.hpccinslink
+       echo "$(readlink "${ins_dir}") @INSTALL_DIR@" > /tmp/.hpccinslink
    fi
 fi