From: Wilfried Göesgens Date: Wed, 20 Feb 2008 19:40:54 +0000 (+0000) Subject: * sanitize migrate_aliases.sh X-Git-Tag: v7.86~2472 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=6b775c152be76bb93058ab1e6851a383916310cf;p=citadel.git * sanitize migrate_aliases.sh * use migrate_aliases.sh the intended way in the postinst script. --- diff --git a/citadel/debian/citadel-server.postinst b/citadel/debian/citadel-server.postinst index d91229168..367caf766 100644 --- a/citadel/debian/citadel-server.postinst +++ b/citadel/debian/citadel-server.postinst @@ -54,7 +54,7 @@ set >/tmp/citsetup cat $WELCOMEHTML; printf "\r\n\r\n--$SEPERATOR--\r\n\r\n") | \ /usr/sbin/citmail -bm -r "$FROM" "$TO" - /usr/lib/citadel-server/migrate_aliases.sh + /usr/lib/citadel-server/migrate_aliases.sh /etc/citadel/mail.aliases fi if test -S /var/run/citadel/citadel.socket; then diff --git a/citadel/migrate_aliases.sh b/citadel/migrate_aliases.sh index 9408135f2..a2360e85f 100755 --- a/citadel/migrate_aliases.sh +++ b/citadel/migrate_aliases.sh @@ -1,4 +1,8 @@ #!/bin/bash +if test -z "$1"; then + echo "Usage: $0 mail.aliases" + exit +fi CITALIAS=$1 if test -f /etc/aliases; then @@ -15,7 +19,7 @@ if test -f /etc/aliases; then for ((i=1; i <= $NLINES; i++)); do ALIAS=`head -n $i /tmp/aliases |tail -n 1` ORG=`echo $ALIAS|sed "s;,.*;;"` - if grep $ORG $CITALIAS; then + if grep "$ORG" "$CITALIAS"; then echo "Ignoring Alias $ORG as its alreday there" else echo "$ALIAS" >>$CITALIAS