diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-12-12 16:11:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-12-12 16:11:51 +0000 |
commit | 33e3bf199e6848d71c73c581fa83fecbeeb1903b (patch) | |
tree | 769e40a0abea3265f329090c56b690d619a86a84 /debian/functions | |
parent | Merging upstream version 3.9.1. (diff) | |
download | postfix-33e3bf199e6848d71c73c581fa83fecbeeb1903b.tar.xz postfix-33e3bf199e6848d71c73c581fa83fecbeeb1903b.zip |
Merging debian version 3.9.1-4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/functions')
-rw-r--r-- | debian/functions | 81 |
1 files changed, 38 insertions, 43 deletions
diff --git a/debian/functions b/debian/functions index b202a51..7d08481 100644 --- a/debian/functions +++ b/debian/functions @@ -1,48 +1,43 @@ -addmap() -{ - name=$1 - if [ "x$2" != "x" ]; then - mkmap=${2:=} +# 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 - FILE=/etc/postfix/dynamicmaps.cf - if ! grep -q "^${name}[[:space:]]" ${FILE}; then - echo "Adding ${name} map entry to ${FILE}" - echo "${name} postfix-${name}.so dict_${name}_open ${mkmap}" >> ${FILE} - fi - return 0 + echo "Registering Postfix dynamic map entry $map in $DYNAMICMAPS" + echo "$line" >> $DYNAMICMAPS } -delmap() -{ - name=$1 - FILE=/etc/postfix/dynamicmaps.cf - if grep -q "^${name}[[:space:]]" ${FILE}; then - echo "Removing ${name} map entry from ${FILE}" - sed "/^${name}[[:space:]]/d" ${FILE} > ${FILE}.$$ && \ - cp ${FILE}.$$ ${FILE} && \ - rm ${FILE}.$$ - fi - return 0 + +postinst_addmap() { # used only in 3.9.1-[12] + [ configure = "$1" ] || return 0 + map=${DPKG_MAINTSCRIPT_PACKAGE#*-} + addmap $map } -runnewaliases() { - db_get postfix/main_mailer_type && mailer="$RET" - if [ "$mailer" != "No configuration" ] || [ -f /etc/postfix/main.cf ]; then - db_fget postfix/newaliases run || true - if ( $RET ); then - echo "Running newaliases" - rm -f /etc/aliases.db # handle the roll to db2.0 - # newaliases chokes if hostname not set - # newaliases is equivalent to postalias $(postconf -hx alias_database) - # and in debootstrap, newaliases == /bin/true... - if [ -z "$(postconf -hx myhostname||true)" ]; then - cp -a main.cf main.cf.dpkg.$$ - postconf -e 'myhostname=debian' - newaliases - db_fset postfix/newaliases run false - mv main.cf.dpkg.$$ main.cf - else - newaliases - db_fset postfix/newaliases run false - fi - fi + +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 + : +} |