From: Dinko Korunic <kreator@carnet.hr>
Date: Sun, 12 Apr 2009 12:04:35 +0000 (+0200)
Subject: - u slucaju da nema Postfix main.cf ili master.cf, izadji iz instalacije i javi gresk... 
X-Git-Tag: v2.6.4-1~9
X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=commitdiff_plain;h=28c8e45aef2fa269afa8bca3b78ffa6398829413;p=amavisd-cn.git

- u slucaju da nema Postfix main.cf ili cf, izadji iz instalacije i javi gresku (nece raditi newaliases, cp_mail, postconf, itd...)
---

diff --git a/src/postfix.sh b/src/postfix.sh
index 9099243..5a2a0b8 100755
--- a/src/postfix.sh
+++ b/src/postfix.sh
@@ -1,18 +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
-    restart_mta=1
+  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
 
   # set up main.cf
-  if [ ! -f /etc/postfix/main.cf ] || \
-      ! grep -q "^content_filter[\t ]*=[\t ]*smtp-amavis:\[127.0.0.1\]:10024[\t ]*" \
+  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
+      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
 }