aboutsummaryrefslogtreecommitdiff
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
parentb369fd244e1e9be5a36781135d1706cdd138e78c (diff)
system/drbd-tools: Handle .new files correctly.
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
-rw-r--r--system/drbd-tools/doinst.sh23
-rw-r--r--system/drbd-tools/drbd-tools.SlackBuild1
2 files changed, 15 insertions, 9 deletions
diff --git a/system/drbd-tools/doinst.sh b/system/drbd-tools/doinst.sh
index 5963b24bb250..dd9569973fcd 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
diff --git a/system/drbd-tools/drbd-tools.SlackBuild b/system/drbd-tools/drbd-tools.SlackBuild
index 26f6f6ab8dd8..fe8b0aaeec8d 100644
--- a/system/drbd-tools/drbd-tools.SlackBuild
+++ b/system/drbd-tools/drbd-tools.SlackBuild
@@ -102,6 +102,7 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}