summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-11-08 21:47:28 +0100
committerJonas Smedegaard <dr@jones.dk>2010-11-08 21:47:28 +0100
commit50be5f7c0f3d5b245da0c9ab640b6e86e8a612ea (patch)
tree580a6d19228f257b9f8a7684f729ebb6c0c8e73c
parent9ca589b71c148fe7bacd32e6708d8cbb283e956f (diff)
parent1d0139d9ab55d12e281da5fe5fc6a7e862f2a3ae (diff)
Merge branch 'master' of git://source.jones.dk/local-COMMON
-rwxr-xr-xamavis/mklists.sh29
-rwxr-xr-xpostfix/postfix.sh4
2 files changed, 21 insertions, 12 deletions
diff --git a/amavis/mklists.sh b/amavis/mklists.sh
index f7db451..7a7b4fd 100755
--- a/amavis/mklists.sh
+++ b/amavis/mklists.sh
@@ -12,8 +12,13 @@ set -e
# Let's standardize sort
export LC_ALL=C
-realmsdir='/etc/local-REDPILL'
-domainconfdir='/etc/local-ORG/amavis'
+basedir=${basedir:-/etc}
+REDPILL=${REDPILL:-REDPILL}
+ORG=${ORG:-ORG}
+realmsdir=${realmsdir:-$basedir/local-$REDPILL}
+domaindir=${domaindir:-$basedir/local-$ORG}
+domainconfdir=${domainconfdir:-$domaindir/amavis}
+localdir=${localdir:-$basedir/local}
if ! [ -d "$realmsdir" ]; then
echo "WARNING: Realms directory \"$realmsdir\" does not exist."
fi
@@ -25,15 +30,15 @@ catfilefromownrealm() {
file="$1"
[ -d "$realmsdir" ] || exit 0
- thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')"
+ thisrealm="$(cat "$domaindir/realm" || dnsdomainname | tr '[a-z]' '[A-Z]')"
- if [ -r /etc/local/"$file"_exceptions ]; then
- grep -vFf /etc/local/"$file"_exceptions "$realmsdir/$thisrealm/$file"
+ if [ -r "$localdir/${file}_exceptions" ]; then
+ grep -vFf "$localdir/${file}_exceptions" "$realmsdir/$thisrealm/$file"
else
cat "$realmsdir/$thisrealm/$file"
fi
- if [ -r /etc/local/"$file"_additions ]; then
- cat /etc/local/"$file"_additions
+ if [ -r "$localdir/${file}_additions" ]; then
+ cat "$localdir/${file}_additions"
fi
}
@@ -43,19 +48,19 @@ catallfilesfromotherrealms() {
[ -f "$realmsdir/realms" ] || exit 0
realms="$(cat "$realmsdir/realms" | sed 's/#.*//')"
- thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')"
+ thisrealm="$(cat "$domaindir/realm" || dnsdomainname | tr '[a-z]' '[A-Z]')"
for realm in $realms; do
if [ "$thisrealm" != "$realm" ]; then
- if [ -r /etc/local/$"file"_additions ]; then
- grep -vFf /etc/local/"$file"_additions "$realmsdir/$realm/$file"
+ if [ -r "$localdir/${file}_additions" ]; then
+ grep -vFf "$localdir/${file}_additions" "$realmsdir/$realm/$file"
else
cat "$realmsdir/$realm/$file"
fi
fi
done
- if [ -r /etc/local/"$file"_exceptions ]; then
- cat /etc/local/"$file"_exceptions
+ if [ -r "$localdir/${file}_exceptions" ]; then
+ cat "$localdir/${file}_exceptions"
fi
}
diff --git a/postfix/postfix.sh b/postfix/postfix.sh
index 102b8dc..21e6458 100755
--- a/postfix/postfix.sh
+++ b/postfix/postfix.sh
@@ -73,6 +73,7 @@ else
fi
catfilefromownrealm() {
+ set -e
file="$1"
[ -d "$realmsdir" ] || exit 0
@@ -82,6 +83,7 @@ catfilefromownrealm() {
}
catallfilesfromotherrealms() {
+ set -e
file="$1"
[ -d "$realmsdir" ] || exit 0
[ -f "$realmsdir/realms" ] || exit 0
@@ -97,6 +99,7 @@ catallfilesfromotherrealms() {
}
catfirstfile() {
+ set -e
file="$1"
configdir=''
for dir in $configdirs; do
@@ -112,6 +115,7 @@ catfirstfile() {
}
getlinesfromfile() {
+ set -e
param="$1"
shift
replacements=