43 lines
1.2 KiB
Text
43 lines
1.2 KiB
Text
# 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
|
|
:
|
|
}
|