diff options
author | Mario Preksavec <mario at slackware dot hr> | 2015-02-28 10:50:29 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-02-28 11:06:38 +0700 |
commit | f195a7670f5b6ba9d65ef2b2e5f1c268aeb6e998 (patch) | |
tree | bb849d94a68f29db16db6cd859c216c27f1e4d4e /network/icinga2/doinst.sh | |
parent | afc34a0ef3011b83a6dbe2de7753229e9abdef49 (diff) |
network/icinga2: Added (Network resource monitoring system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/icinga2/doinst.sh')
-rw-r--r-- | network/icinga2/doinst.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/network/icinga2/doinst.sh b/network/icinga2/doinst.sh new file mode 100644 index 0000000000000..c43eb0cfa1001 --- /dev/null +++ b/network/icinga2/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.icinga2.new +config etc/bash_completion.d/icinga2.new +config etc/logrotate.d/icinga2.new +config etc/sysconfig/icinga2.new + +find etc/icinga2 usr/share/icinga2 -type f -name '*.new' \ + | while read new ; do config $new ; done |