2011-11-08 16:23:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp
|
|
|
|
|
|
|
|
make_aliasesdb() {
|
2023-10-09 16:22:23 +00:00
|
|
|
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" ]
|
2011-11-08 16:23:51 +00:00
|
|
|
then
|
2023-10-09 16:22:23 +00:00
|
|
|
# /etc/aliases.db|lmdb may be used by other MTA, make sure nothing
|
2011-11-08 16:23:51 +00:00
|
|
|
# has touched it since our last newaliases call
|
2023-10-09 16:22:23 +00:00
|
|
|
[ /etc/aliases -nt /etc/aliases.$MAP ] ||
|
|
|
|
[ "$ALIASESDB_STAMP" -nt /etc/aliases.$MAP ] ||
|
|
|
|
[ "$ALIASESDB_STAMP" -ot /etc/aliases.$MAP ] || return 0
|
2011-11-08 16:23:51 +00:00
|
|
|
/usr/bin/newaliases
|
2023-10-09 16:22:23 +00:00
|
|
|
touch -r /etc/aliases.$MAP "$ALIASESDB_STAMP"
|
2011-11-08 16:23:51 +00:00
|
|
|
else
|
|
|
|
/usr/bin/newaliases
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
make_aliasesdb
|