summaryrefslogtreecommitdiff
path: root/system/drbd-utils/doinst.sh
diff options
context:
space:
mode:
authorMario Preksavec <mario@slackware.hr>2014-11-12 09:01:01 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-11-12 09:01:01 +0700
commitd2ab88feeb1af4729923cb4dad494ae569e926e9 (patch)
treeb0ee2eeda6744a0f7e67693ba824b794add76a78 /system/drbd-utils/doinst.sh
parent6605bc58909888cdf50b6d047573fa233d7f54a1 (diff)
downloadslackbuilds-d2ab88feeb1af4729923cb4dad494ae569e926e9.tar.gz
system/drbd-utils: Added (Management utilities for DRBD).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/drbd-utils/doinst.sh')
-rw-r--r--system/drbd-utils/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/system/drbd-utils/doinst.sh b/system/drbd-utils/doinst.sh
new file mode 100644
index 0000000000..0ff55c70a4
--- /dev/null
+++ b/system/drbd-utils/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 copy
+ 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
+}
+
+preserve_perms etc/rc.d/rc.drbd.new
+preserve_perms etc/drbd.conf.new
+preserve_perms etc/drbd.d/global_common.conf.new