summaryrefslogtreecommitdiff
path: root/system/monit/doinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'system/monit/doinst.sh')
-rw-r--r--system/monit/doinst.sh19
1 files changed, 12 insertions, 7 deletions
diff --git a/system/monit/doinst.sh b/system/monit/doinst.sh
index 1a24db5994..293507cbb1 100644
--- a/system/monit/doinst.sh
+++ b/system/monit/doinst.sh
@@ -11,12 +11,17 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
-# Keep same perms on rc.monit.new:
-if [ -e etc/rc.d/rc.monit ]; then
- cp -a etc/rc.d/rc.monit etc/rc.d/rc.monit.new.incoming
- cat etc/rc.d/rc.monit.new > etc/rc.d/rc.monit.new.incoming
- mv etc/rc.d/rc.monit.new.incoming etc/rc.d/rc.monit.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
+}
-config etc/rc.d/rc.monit.new
+preserve_perms etc/rc.d/rc.monit.new
+config etc/monit.conf.new