summaryrefslogtreecommitdiffstats
path: root/system/apparmor/doinst.sh
diff options
context:
space:
mode:
author pyllyukko2018-07-06 18:02:05 +0200
committer Willy Sudiarto Raharjo2018-07-07 01:54:18 +0200
commita754bbc792ecca91d7e951bd10e46ff715bec958 (patch)
tree68628ef9aa56f7f95e652b4e1d4030c518a955e2 /system/apparmor/doinst.sh
parenta274538685d16c0f4e6a6e05121a2600f010bc11 (diff)
downloadslackbuilds-a754bbc792ecca91d7e951bd10e46ff715bec958.tar.gz
system/apparmor: Added (Mandatory Access Control mechanism).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/apparmor/doinst.sh')
-rw-r--r--system/apparmor/doinst.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/system/apparmor/doinst.sh b/system/apparmor/doinst.sh
new file mode 100644
index 0000000000..7715ef2c3a
--- /dev/null
+++ b/system/apparmor/doinst.sh
@@ -0,0 +1,31 @@
+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.apparmor.new
+config etc/apparmor/easyprof.conf.new
+config etc/apparmor/logprof.conf.new
+config etc/apparmor/notify.conf.new
+config etc/apparmor/parser.conf.new
+config etc/apparmor/subdomain.conf.new
+config etc/apparmor/severity.db.new