aboutsummaryrefslogtreecommitdiff
path: root/system/incron/doinst.sh
diff options
context:
space:
mode:
authorMarek Srejma <sam_web@yahoo.de>2017-04-30 21:36:22 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-04-30 21:36:22 +0700
commit7000ec52a66a66af713a3b53638c312b4a2def5e (patch)
tree9a4eb6231c2baeef4515e0dbf1b8c322d9584071 /system/incron/doinst.sh
parentad1a1d82ce65a9a1b79ac9c2bd73cabd867e1a35 (diff)
system/incron: Updated for version 0.6.0 + new maintainer.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/incron/doinst.sh')
-rw-r--r--system/incron/doinst.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/system/incron/doinst.sh b/system/incron/doinst.sh
new file mode 100644
index 0000000000000..56ac195452aab
--- /dev/null
+++ b/system/incron/doinst.sh
@@ -0,0 +1,25 @@
+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.incrond.new