clamav PID introduced again
[monit-cn.git] / debian / postinst
index 5b887c2..2e2af2f 100755 (executable)
@@ -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