diff options
author | Jonas Smedegaard <dr@jones.dk> | 2007-07-11 17:28:40 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2007-07-11 17:28:40 +0000 |
commit | d71c1d985c8cfc117ad3e9a2aad7f9111016a150 (patch) | |
tree | e20553d5ec3c441553b6ede9289b6974a332d826 | |
parent | 62936636ee958a046acf2ee43e93c3014388db41 (diff) |
Support several prioritized locations for paramfiles.
-rwxr-xr-x | postfix/postfix.sh | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/postfix/postfix.sh b/postfix/postfix.sh index cf26162..63c10b8 100755 --- a/postfix/postfix.sh +++ b/postfix/postfix.sh @@ -3,7 +3,7 @@ # /etc/local-COMMON/postfix/postfix.sh # Copyright 2002-2004 Jonas Smedegaard <dr@jones.dk> # -# $Id: postfix.sh,v 1.35 2007-06-06 11:05:48 jonas Exp $ +# $Id: postfix.sh,v 1.36 2007-07-11 17:28:40 jonas Exp $ # # Auto-tweak plain installed postfix Debian package # @@ -16,7 +16,7 @@ set -e -paramdir='/etc/local-COMMON/postfix' +paramdirs='/etc/local/postfix /etc/local-ORG/postfix /etc/local-REDPILL/postfix /etc/local-COMMON/postfix' confdir='/etc/postfix' postconf=/usr/sbin/postconf sp='[[:space:]]' @@ -55,12 +55,6 @@ else fi sasldir="$confdir/sasl" -#function getlinesfromfile() { -# param="$1" -# echo -n "$param = " -# cat $paramdir/$param | grep -v '^#' | sed 's/#.*//' | tr '\n' ',' | sed -e 's/^[, ]*//' -e 's/[, ]\+/,/g' -e 's/,$//' -#} - function getlinesfromfile() { param="$1" shift @@ -87,6 +81,17 @@ function getlinesfromfile() { done replacements="$replacements;s/$oldparam/$newstring/" done + paramdir='' + for dir in $paramdirs; do + if [ -d "$dir" ] && [ -f "$dir/$param" ]; then + paramdir="$dir" + break + fi + done + if [ -z "$paramdir" ]; then + echo "ERROR: Parameter file for \"$param\" not found." + exit 1 + fi echo -n "$param = " cat $paramdir/$param | sed 's/#.*//' | tr '\n' ',' | sed -e 's/^[, ]*//;s/[, ]\+/,/g' -e 's/\^/ /g' -e "s/,\$//$replacements" } |