summaryrefslogtreecommitdiffstats
path: root/system/sudosh2/doinst.sh
diff options
context:
space:
mode:
author Sean Donner <sean.donner@gmail.com>2013-02-13 18:40:58 -0500
committer dsomero <xgizzmo@slackbuilds.org>2013-02-13 19:34:06 -0500
commitc2b1f1137e757b3a3f21e7c6dda333b058e84e85 (patch)
treecff3695b6570089d0c45e179453f09888f584ed4 /system/sudosh2/doinst.sh
parent73706918a5e0a4bb178a43f4a9d8e2f3855163a7 (diff)
downloadslackbuilds-c2b1f1137e757b3a3f21e7c6dda333b058e84e85.tar.gz
slackbuilds-c2b1f1137e757b3a3f21e7c6dda333b058e84e85.tar.xz
system/sudosh2: Added (tool for server auditing and shell reporting)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'system/sudosh2/doinst.sh')
-rw-r--r--system/sudosh2/doinst.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/system/sudosh2/doinst.sh b/system/sudosh2/doinst.sh
new file mode 100644
index 0000000000..515a0a3487
--- /dev/null
+++ b/system/sudosh2/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/sudosh.conf.new