postfix/postfix.aliasesdb
Jaroslav Škarvada 6a2621e4d7 Drop libdb for RHEL>9
Related: rhbz#1788480
2023-10-09 18:22:23 +02:00

26 lines
890 B
Bash

#!/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