summaryrefslogtreecommitdiff
path: root/system/heartbeat/doinst.sh
diff options
context:
space:
mode:
authorPierre-Philipp Braun <pbraun@nethence.com>2020-04-24 07:39:23 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-04-24 07:39:23 +0700
commitbdd030c118c7dd5996113f9afa2f4ef7f8e1fd78 (patch)
tree352d6a0c1db8763b94e0464cbf6cfe14b89404e0 /system/heartbeat/doinst.sh
parentde24fb3e8b1e63f3ba582fcffb57332ff5973d99 (diff)
downloadslackbuilds-bdd030c118c7dd5996113f9afa2f4ef7f8e1fd78.tar.gz
system/heartbeat: Added (Linux-HA heartbeat).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/heartbeat/doinst.sh')
-rw-r--r--system/heartbeat/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/system/heartbeat/doinst.sh b/system/heartbeat/doinst.sh
new file mode 100644
index 0000000000..bdba1fdb05
--- /dev/null
+++ b/system/heartbeat/doinst.sh
@@ -0,0 +1,27 @@
+config() {
+ NEW="$1"
+ OLD="`dirname $NEW`/`basename $NEW .new`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant cop
+y
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
+ if [ -e ${OLD} ]; then
+ cp -a ${OLD} ${NEW}.incoming
+ cat ${NEW} > ${NEW}.incoming
+ mv ${NEW}.incoming ${NEW}
+ fi
+ config ${NEW}
+}
+
+config etc/ha.d/authkeys.new
+config etc/ha.d/ha.cf.new
+config etc/ha.d/haresources.new
+preserve_perms etc/init.d/heartbeat.new