summaryrefslogtreecommitdiff
path: root/system/drbd-tools/doinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'system/drbd-tools/doinst.sh')
-rw-r--r--system/drbd-tools/doinst.sh23
1 files changed, 14 insertions, 9 deletions
diff --git a/system/drbd-tools/doinst.sh b/system/drbd-tools/doinst.sh
index 5963b24bb2..dd9569973f 100644
--- a/system/drbd-tools/doinst.sh
+++ b/system/drbd-tools/doinst.sh
@@ -11,13 +11,18 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
-# Keep same perms on rc.drbd.new:
-if [ -e etc/rc.d/rc.drbd ]; then
- cp -a etc/rc.d/rc.drbd etc/rc.d/rc.drbd.new.incoming
- cat etc/rc.d/rc.drbd.new > etc/rc.d/rc.drbd.new.incoming
- mv etc/rc.d/rc.drbd.new.incoming etc/rc.d/rc.drbd.new
-fi
+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
-config etc/rc.d/rc.drbd.new
-config etc/drbd.conf.new
-config etc/drbd.d/global_common.conf.new