aboutsummaryrefslogtreecommitdiff
path: root/system/capabilities/doinst.sh
diff options
context:
space:
mode:
authorMenno E. Duursma <druiloor@zonnet.nl>2019-05-04 02:41:28 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-05-04 02:41:28 +0700
commit7f5bccb21f7b2139d8197d65d771747f7df34a31 (patch)
treefacd5a3b9e41deaaa162a466a8e66ce7fb6e5e18 /system/capabilities/doinst.sh
parent96f26a8f7b3e5dfbe2f06d5946641398e26ed88b (diff)
system/capabilities: Added (fcaps).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/capabilities/doinst.sh')
-rw-r--r--system/capabilities/doinst.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/system/capabilities/doinst.sh b/system/capabilities/doinst.sh
new file mode 100644
index 000000000000..1d973e62833f
--- /dev/null
+++ b/system/capabilities/doinst.sh
@@ -0,0 +1,26 @@
+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.capabilities.new
+config etc/default/capabilities.new