You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postfix/SOURCES/postfix.aliasesdb

26 lines
890 B

#!/bin/bash
ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp
make_aliasesdb() {
local MAP=""
local ALIASESDB="$(/usr/sbin/postconf -h alias_database)"
[ "$ALIASESDB" = "hash:/etc/aliases" ] && MAP="db"
[ "$ALIASESDB" = "lmdb:/etc/aliases" ] && MAP="lmdb"
if [ "$MAP" = "db" -o "$MAP" = "lmdb" ]
then
# /etc/aliases.db|lmdb may be used by other MTA, make sure nothing
# has touched it since our last newaliases call
[ /etc/aliases -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -ot /etc/aliases.$MAP ] || return 0
/usr/bin/newaliases
touch -r /etc/aliases.$MAP "$ALIASESDB_STAMP"
else
/usr/bin/newaliases
fi
}
make_aliasesdb