summaryrefslogtreecommitdiffstats
path: root/system/runit-services/doinst.sh
diff options
context:
space:
mode:
author Aaditya Bagga2019-09-21 07:43:22 +0200
committer Willy Sudiarto Raharjo2019-09-21 07:43:22 +0200
commit533ed20ff36ed7c9acfb82617867e4cb9f7dce9d (patch)
tree9788f3e0bdf950f25efdd268795e0bddbfb94e8f /system/runit-services/doinst.sh
parenta4a31c717cfbefff0d89fca6c4e75b6c01df7f83 (diff)
downloadslackbuilds-533ed20ff36ed7c9acfb82617867e4cb9f7dce9d.tar.gz
system/runit-services: Added (services to use with runit).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/runit-services/doinst.sh')
-rw-r--r--system/runit-services/doinst.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/system/runit-services/doinst.sh b/system/runit-services/doinst.sh
new file mode 100644
index 0000000000..55e9fb3f73
--- /dev/null
+++ b/system/runit-services/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...
+}
+
+CONF_FILES=$()
+while IFS= read -r -d ''; do
+ CONF_FILES+=( "$REPLY" )
+done < <(find -L etc/sv -type f -name conf.new -print0)
+
+for conf_file in "${CONF_FILES[@]}"; do
+ if [ "$conf_file" != '' ]; then
+ config "${conf_file}"
+ fi
+done
+