summaryrefslogtreecommitdiffstats
path: root/encap/src/bcfg2-site/bcfg2-site-RENAME
diff options
context:
space:
mode:
Diffstat (limited to 'encap/src/bcfg2-site/bcfg2-site-RENAME')
-rwxr-xr-xencap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl56
1 files changed, 52 insertions, 4 deletions
diff --git a/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl b/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl
index 8a20a968d..1ac29eb7e 100755
--- a/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl
+++ b/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl
@@ -22,17 +22,33 @@ ${MKINSTALLDIRS} "${BASEDIR}/sbin"
rmcp() {
SRCFILENAME="`basename ${1}`"
- if [ -d "${2}" ]; then
+ if [ -d "${2}" ]; then
DESTDIRNAME="$2"
else
DESTDIRNAME="`dirname ${2}`"
fi
TARGETNAME="$DESTDIRNAME/$SRCFILENAME"
- if [ -h "$TARGETNAME" ]; then rm "$TARGETNAME"; fi
- if [ -f "$TARGETNAME" ]; then rm "$TARGETNAME"; fi
+ RMTARGET="no"
+ if [ -h "$TARGETNAME" ]; then RMTARGET="yes"; fi
+ if [ -f "$TARGETNAME" ]; then RMTARGET="yes"; fi
+ if [ "${RMTARGET}x"="yesx" ]; then
+ DATE="`date +%Y-%m-%d--%H-%M-%S`"
+ printf "INFO: Moving old $TARGETNAME to ${TARGETNAME}-${DATE}...\n"
+ cp "$TARGETNAME" "${TARGETNAME}-${DATE}" && rm "$TARGETNAME"
+ fi
+ printf "INFO: Copying %s to %s...\n" "$1" "$2"
cp "$1" "$2"
}
+# bcfg2-client (options)
+if [ "${REPLACE_CONFIG}x" = "yesx" ]; then
+ printf "REPLACE_CONFIG=yes, so removing bcfg2-client sentinel files...\n"
+ S_B="${BASEDIR}/etc/default/bcfg2-client/.SENTINEL_BCFG2"
+ test -f ${S_B} && rm ${S_B}
+ S_S="${BASEDIR}/etc/default/bcfg2-client/.SENTINEL_SITE"
+ test -f ${S_S} && rm ${S_S}
+fi
+
if [ -f ${BASEDIR}/etc/default/bcfg2-client/.SENTINEL_BCFG2 ]; then
printf "INFO: bcfg2 client options have been updated by bcfg2 -\n"
printf "INFO: not replacing that configuration.\n"
@@ -46,6 +62,15 @@ else
touch ${BASEDIR}/$DIR/.SENTINEL_SITE
fi
+# bcfg2-server (options)
+if [ "${REPLACE_CONFIG}x" = "yesx" ]; then
+ printf "REPLACE_CONFIG=yes, so removing bcfg2-server sentinel files...\n"
+ S_B="${BASEDIR}/etc/default/bcfg2-server/.SENTINEL_BCFG2"
+ test -f ${S_B} && rm ${S_B}
+ S_S="${BASEDIR}/etc/default/bcfg2-server/.SENTINEL_SITE"
+ test -f ${S_S} && rm ${S_S}
+fi
+
if [ -f ${BASEDIR}/etc/default/bcfg2-server/.SENTINEL_BCFG2 ]; then
printf "INFO: bcfg2 server options have been updated by bcfg2 -\n"
printf "INFO: not replacing that configuration.\n"
@@ -58,6 +83,15 @@ else
touch ${BASEDIR}/$DIR/.SENTINEL_SITE
fi
+# bcfg2.conf & ostiary.conf
+if [ "${REPLACE_CONFIG}x" = "yesx" ]; then
+ printf "REPLACE_CONFIG=yes, so removing ${BASEDIR}/etc sentinel files...\n"
+ S_B="${BASEDIR}/etc/.SENTINEL_BCFG2"
+ test -f ${S_B} && rm ${S_B}
+ S_S="${BASEDIR}/etc/.SENTINEL_SITE"
+ test -f ${S_S} && rm ${S_S}
+fi
+
if [ -f ${BASEDIR}/etc/.SENTINEL_BCFG2 ]; then
printf "INFO: bcfg2.conf and/or ostiary.cfg may have been updated by\n"
printf "INFO: bcfg2 - not replacing that configuration.\n"
@@ -70,6 +104,15 @@ else
touch ${BASEDIR}/etc/.SENTINEL_SITE
fi
+# ost-bcfg2.sh
+if [ "${REPLACE_CONFIG}x" = "yesx" ]; then
+ printf "REPLACE_CONFIG=yes, so removing ${BASEDIR}/sbin sentinel files...\n"
+ S_B="${BASEDIR}/sbin/.SENTINEL_BCFG2"
+ test -f ${S_B} && rm ${S_B}
+ S_S="${BASEDIR}/sbin/.SENTINEL_SITE"
+ test -f ${S_S} && rm ${S_S}
+fi
+
if [ -f ${BASEDIR}/sbin/.SENTINEL_BCFG2 ]; then
printf "INFO: ost-bcfg2.sh may have been updated by bcfg2 -\n"
printf "INFO: not replacing that configuration with this script.\n"
@@ -81,8 +124,10 @@ else
touch ${BASEDIR}/sbin/.SENTINEL_SITE
fi
+# ostiary (daemontools)
if [ ! -h /service/ostiary ]; then
if [ -d /usr/local/var/svc.d/ostiary ]; then
+ printf "INFO: Enabling ostiary service (via daemontools)...\n"
ln -s /usr/local/var/svc.d/ostiary /service/ostiary
else
printf "ERROR: /usr/local/var/svc.d/ostiary does not exist.\n"
@@ -92,19 +137,22 @@ else
printf "INFO: /service/ostiary already exists, not replacing...\n"
fi
+# bcfg2-client (daemontools)
//if int(@BCFG2_CLIENT_RUN_INTERVAL_SECONDS) > 0
if [ ! -h /service/bcfg2-client ]; then
if [ -d /usr/local/var/svc.d/bcfg2-client ]; then
+ printf "INFO: Enabling bcfg2-client service (via daemontools)...\n"
ln -s /usr/local/var/svc.d/bcfg2-client /service/bcfg2-client
else
printf "ERROR: /usr/local/var/svc.d/bcfg2-client does not exist.\n"
- exit 1
+ printf "ERROR: Could not enable bcfg2-client service.\n"
fi
else
printf "INFO: /service/bcfg2-client already exists, not replacing...\n"
fi
//end if
+# end
printf "Finished ${ENCAP_PKGNAME} postinstall script.\n"
exit 0