aboutsummaryrefslogtreecommitdiff
path: root/system/anything-sync-daemon/doinst.sh
diff options
context:
space:
mode:
authorWinkel Manah <winkel.manah@outlook.com>2015-07-22 10:42:13 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-07-22 10:42:13 +0700
commit945b6bba3a82dfe7cbd4a8d0180ca34d7071b47e (patch)
treeb83fef1a4038b5ebb33d653a76b68ff1df635ae7 /system/anything-sync-daemon/doinst.sh
parent1facdd736c831889c0043433474b37c5b93a43d2 (diff)
system/anything-sync-daemon: Added (pseudo-daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/anything-sync-daemon/doinst.sh')
-rw-r--r--system/anything-sync-daemon/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/system/anything-sync-daemon/doinst.sh b/system/anything-sync-daemon/doinst.sh
new file mode 100644
index 0000000000000..9add9af13f928
--- /dev/null
+++ b/system/anything-sync-daemon/doinst.sh
@@ -0,0 +1,27 @@
+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.asd.new
+config etc/cron.hourly/asd-update.new
+config etc/asd.conf.new