X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=2e2af2f514f3753725fd93ee8d733222278c739e;hb=666ac8933b56d123a605fee46d165a55dfcb39a1;hp=5b887c2d10742c68d526bff9c5773c0d85e63603;hpb=4021af87bb46b6ad7922e87d15e67561c41fd0d9;p=monit-cn.git diff --git a/debian/postinst b/debian/postinst index 5b887c2..2e2af2f 100755 --- a/debian/postinst +++ b/debian/postinst @@ -5,13 +5,13 @@ set -e [ "$1" = "configure" ] || exit 0 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx -# Load CARNet Tools +# Load CARNET Tools . /usr/share/carnet-tools/functions.sh # check if monitrc is ours installfile=1 if [ -e /etc/monit/monitrc ]; then - if ! grep -q "CARNet package monit-cn" /etc/monit/monitrc; then + if ! grep -q "CARNET package monit-cn" /etc/monit/monitrc; then installfile=1 mv -f /etc/monit/monitrc /etc/monit/monitrc.dpkg-old else @@ -33,6 +33,15 @@ if grep -q '@localhost' /etc/monit/monitrc; then /etc/monit/monitrc || true fi +# sed bacula-fd.conf with proper hostname +if grep -q '127.0.0.1' /usr/share/monit-cn/bacula-fd.conf; then + cp_check_and_sed '127.0.0.1' \ + "s/127.0.0.1/$CARNET_HOSTNAME.$CARNET_DOMAINNAME/" \ + /usr/share/monit-cn/bacula-fd.conf || true +fi + +# you can modify others in a loop, maybe? + # migrate to "but not on { instance }" alerting style cp_check_and_sed '^set alert [^[:space:]]*@[^[:space:]]* ' \ 's/^set alert \([^[:space:]]*@[^[:space:]]*\) .*$/set alert \1 but not on { instance }/g' \ @@ -54,7 +63,7 @@ cp_check_and_sed '^START[[:space:]]*=[[:space:]]*no' \ 's/^START[[:space:]]*=.*/START=yes/g' /etc/default/monit || true # remove us from systemv monit script -if grep -q 'CARNet package monit-cn' /etc/init.d/monit; then +if grep -q 'CARNET package monit-cn' /etc/init.d/monit; then echo "CN: Removing monit workaround from /etc/init.d/monit -- systemd is in use" cp-update -r monit-cn /etc/init.d/monit chmod +x /etc/init.d/monit