diff options
author | Ebben Aries <slackbuilds@dscp.org> | 2021-01-01 23:59:21 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2021-01-02 10:48:27 +0700 |
commit | a4d0c91859d037090effb0c11b3873ef1b6e4a1b (patch) | |
tree | b7c379bca9d7ae2d2d108ec8c3a56d004958d1f3 /system/prometheus/doinst.sh | |
parent | 5fb3b0a24caf4472cbcc8d027dfea6c3c9ad875f (diff) |
system/prometheus: Added (Open-Source Monitoring & Alerting Toolkit)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/prometheus/doinst.sh')
-rw-r--r-- | system/prometheus/doinst.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/system/prometheus/doinst.sh b/system/prometheus/doinst.sh new file mode 100644 index 0000000000000..5e73a492a172f --- /dev/null +++ b/system/prometheus/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 +} + +config etc/prometheus/prometheus.yml.new + +preserve_perms etc/rc.d/rc.prometheus.new |