- u slucaju da nema Postfix main.cf ili master.cf, izadji iz instalacije i javi gresk...
[amavisd-cn.git] / src / postfix.sh
index 1d74552..5a2a0b8 100755 (executable)
@@ -1,14 +1,26 @@
 update_postfix() {
   # set up master.cf
-  if [ -f /etc/postfix/master.cf ] && \
-     ( ! grep -q smtp-amavis /etc/postfix/master.cf || \
-          dpkg --compare-versions "$2" lt $MASTTMPLVERSION ); then
-    noisy_backup /etc/postfix/master.cf
-    cp-update $PKG /etc/postfix/master.cf < $MASTTMPL
+  if [ -f /etc/postfix/master.cf ]; then
+    if ( ! grep -q smtp-amavis /etc/postfix/master.cf || \
+        dpkg --compare-versions "$2" lt $MASTTMPLVERSION ); then
+      noisy_backup /etc/postfix/master.cf
+      cp-update $PKG /etc/postfix/master.cf < $MASTTMPL
+      restart_mta=1
+    fi
+  else
+    echo "CN: Missing Postfix master.cf, please configure Postfix and restart installation."
+    exit 1
   fi
 
-  # main.cf
-  postconf -e content_filter="smtp-amavis:[127.0.0.1]:10024"
-  
-  restart_mta=1
+  # set up main.cf
+  if [ -f /etc/postfix/main.cf ]; then
+      if ! grep -q "^content_filter[\t ]*=[\t ]*smtp-amavis:\[127.0.0.1\]:10024[\t ]*" \
+        /etc/postfix/main.cf; then
+      postconf -e content_filter="smtp-amavis:[127.0.0.1]:10024"
+      restart_mta=1
+    fi
+  else
+    echo "CN: Missing Postfix main.cf, please configure Postfix and restart installation."
+    exit 1
+  fi
 }