- depends na unrar-free ako nema rar ili unrar
[amavisd-cn.git] / src / functions.sh
old mode 100644 (file)
new mode 100755 (executable)
index b67aaab..8a41591
@@ -100,40 +100,6 @@ noisy_backup() {
   cp_echo "CN: Current configuration saved in /var/backups/`basename $1`.bak"
 }
 
-# if fqdn is name.dom3.dom2.dom1.hr, check if this host is MX for
-# either dom3.dom2.dom1.hr, dom2.dom1.hr or dom1.hr and dump highest level
-# domain on stdout
-get_domain() {
-  local domains d
-  RET=$host
-  if ! echo $host | grep -q '\.'; then
-    return
-  fi
-  if [ ! -x /usr/bin/host ]; then
-    cp_echo "CN: no host command... \$mydomain value might be unoptimal."
-    return
-  fi
-  domains=$(hostname -f | awk -F'\.' '
-    {
-      for (i=2; i<NF; i++) { 
-        for (j=i; j<NF; j++) {
-          printf "%s", $(j)"."
-        };
-        print $NF
-      }
-    }'   )
-  for d in $domains
-  do
-    mxes=$(host -t mx $d)
-    # handle output of both /usr/bin/host providers
-    mxes=$(echo "$mxes"|\
-           awk '/mail is handled by/ || /MX/ {print $NF}'|sed s/\.$//)
-    if echo "$mxes" |egrep -q "^$host$"; then
-      RET="$d"
-    fi
-  done
-}
-
 # XXX TODO implement per paragraph conditional munging some day
 in_paragraph() {
   return 1
@@ -172,3 +138,23 @@ conf_from_template() {
   restart_daemon=1
   changed_config=1
 }
+
+# Place configuration tweaks done on upgrades into this function
+update_conf() {
+  # placeholder.
+  # remember to set changed_config=1 and restart_daemon=1 if necessary
+  #:
+  if dpkg --compare-versions "$2" lt "$MASTTMPLVERSION"; then
+    conf_from_template
+  fi
+}
+
+add_redirection() {
+    until [ -z "$1" ]
+    do
+        if [ -e "$1" ] && egrep -q 'amavisd-new-cronjob (sa-sync|sa-clean)$' "$1"; then
+sed -i -e 's:\(^.*amavisd-new-cronjob \(sa-sync\|sa-clean\)$\):\1 1>/dev/null 2>\&1:g' "$1"
+        fi
+        shift
+    done
+}