1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
# Common postfix maintscripts functions
#
# note: this file is used by old (3.9.0) postfix prerm scripts!
DYNAMICMAPS=/etc/postfix/dynamicmaps.cf
addmap() {
map=$1 mkmap="$2"; re="^$map[[:space:]]"
! grep -qs "$re" $DYNAMICMAPS || return 0 # already exists
# use official line if known
if ! line="$(grep "$re" /usr/share/postfix/dynamicmaps.cf)"; then
case "$map$mkmap" in ## skip if mkmap is given in $2
(cdb|lmdb|sdbm) mkmap="mkmap_${map}_open" ;;
esac
line="$map postfix-$map.so dict_${map}_open $mkmap"
fi
echo "Registering Postfix dynamic map entry $map in $DYNAMICMAPS"
echo "$line" >> $DYNAMICMAPS
}
postinst_addmap() { # used only in 3.9.1-[12]
[ configure = "$1" ] || return 0
map=${DPKG_MAINTSCRIPT_PACKAGE#*-}
addmap $map
}
delmap() {
map=$1
if grep -qs "^$map[[:space:]]" $DYNAMICMAPS; then
echo "Removing $map map entry from $DYNAMICMAPS"
sed -i "/^$map[[:space:]]/d" $DYNAMICMAPS
fi
}
prerm_delmap() { # used only in 3.9.1-[12]
[ remove = "$1" -o purge = "$1" ] || return 0
map=${DPKG_MAINTSCRIPT_PACKAGE#*-}
delmap $map
}
runnewaliases() { # used by postfix and dynamicmaps postinst in <3.9.1-3
:
}
|