Browse Source

HPCC-9488 Better handling of changes to config files

Reinstate the spurious additional call to init code called by the
post-uninstall, and instead put in a mechanism to ensure that init code only
executes once.

This kludge is apparently necessary on earlier Ubuntu builds to work around a
dpkg bug.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
b7c3a93af5

+ 7 - 0
initfiles/bash/etc/init.d/install-init.in

@@ -133,6 +133,9 @@ SECTION=${SECTION:-DEFAULT}
 confToUse="${INSTALL_DIR}${CONFIG_DIR}/${ENV_CONF_FILE}"
 
 if [ -d ${CONFIG_DIR} ]; then
+    if [ -f ${CONFIG_DIR}/installed ] ; then
+        exit 0
+    fi
     if [ -e ${CONFIG_DIR}/${ENV_CONF_FILE} ]; then
         confToUse="${CONFIG_DIR}/${ENV_CONF_FILE}"
     fi
@@ -271,3 +274,7 @@ fi
 chown root:$group ${configs}
 chown -R $user:$group ${configs}/*
 chmod 775 ${configs}
+
+if [ -d ${CONFIG_DIR} ]; then
+    date > ${CONFIG_DIR}/installed
+fi

+ 9 - 1
initfiles/bash/sbin/deb/postrm.in

@@ -17,4 +17,12 @@
 
 ###<REPLACE>###
 
-# Nothing to do - we do it all in prerm
+# On some systems, when running an update (as opposed to a remove) the postinstall script does
+# not get run. To work around that issue, we run the post-install actions in the post-remove script
+# (which IS run)
+#
+# 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
+fi

+ 10 - 3
initfiles/sbin/prerm.in

@@ -25,20 +25,27 @@ if [ $configmgr_status -gt 0 ]; then
     exit 1
 fi
 
-
 # Stop all services before cleaning up
 ######################################
 /etc/init.d/hpcc-init stop
 if [ -f "${PID_DIR}/mydafilesrv.pid" ]; then
     /etc/init.d/dafilesrv stop
 fi
-# Removing edits from /etc files
+
+# Remove edits from /etc files
+##############################
 ${INSTALL_DIR}/sbin/rm_conf_settings.sh
 
 
-# Removing symlinks.
+# Remove symlinks
+#################
 ${INSTALL_DIR}/etc/init.d/uninstall-init
 
+# Remove installed flag
+#######################
+if [ -f ${CONFIG_DIR}/installed ] ; then
+    rm ${CONFIG_DIR}/installed
+fi
 
 exit 0