aboutsummaryrefslogtreecommitdiff
path: root/system/drbd-tools/doinst.sh
diff options
context:
space:
mode:
authordsomero <xgizzmo@slackbuilds.org>2011-03-23 18:21:19 -0400
committerRobby Workman <rworkman@slackbuilds.org>2011-03-24 19:23:17 -0500
commitcd50870a09e7591b461b533f37c5d43f4315ce97 (patch)
tree8575c0d095ce479a32597c3536f14af27be9d3a0 /system/drbd-tools/doinst.sh
parentb369fd244e1e9be5a36781135d1706cdd138e78c (diff)
system/drbd-tools: Handle .new files correctly.
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
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 5963b24bb2509..dd9569973fcd0 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