Closes: #862258 debian/mlmmj.postinst and debian/mlmmj.postrm rewrite based upon maintainer scripts from the sbuild package.
Plus some minor changes. --- debian/control | 4 ++- debian/cron.d | 2 +- debian/mlmmj.postinst | 73 ++++++++++++++++++++++++++++++++++++++- debian/mlmmj.postrm | 57 ++++++++++++++++++------------ debian/patches/mlmmj_user_added | 36 +++++++++++++++++++ debian/patches/series | 1 + 6 files changed, 148 insertions(+), 25 deletions(-) create mode 100644 debian/patches/mlmmj_user_added diff --git a/debian/control b/debian/control index 198b7de..7fc48c7 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,9 @@ Homepage: http://mlmmj.org/ Package: mlmmj Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, postfix | exim4 | mail-transport-agent +Depends: ${shlibs:Depends}, ${misc:Depends} + , postfix | exim4 | mail-transport-agent + , adduser Suggests: mlmmj-php-web, mlmmj-php-web-admin Description: mail server independent mailing list manager A mailing list manager with roughly the same functionality as ezmlm. diff --git a/debian/cron.d b/debian/cron.d index 97d2c8c..2f34265 100644 --- a/debian/cron.d +++ b/debian/cron.d @@ -1 +1 @@ -0 */2 * * * root /usr/bin/test -x /usr/bin/mlmmj-maintd && /usr/bin/mlmmj-maintd -F -d /var/spool/mlmmj +0 */2 * * * mlmmj /usr/bin/test -x /usr/bin/mlmmj-maintd && /usr/bin/mlmmj-maintd -F -d /var/spool/mlmmj diff --git a/debian/mlmmj.postinst b/debian/mlmmj.postinst index 9d168c3..8c2ec9d 100644 --- a/debian/mlmmj.postinst +++ b/debian/mlmmj.postinst @@ -1,4 +1,7 @@ #!/bin/sh +# postinst script for mlmmj +# +# see: dh_installdeb(1) set -e @@ -9,7 +12,75 @@ else echo "No debconf installed" fi -mkdir -p /var/spool/mlmmj +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see /usr/share/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + # If mlmmj is a user group, migrate to a system group. Save + # a list of group members, then add them back to the new group + # once created. + SGID="$(grep ^mlmmj: /etc/group | sed -r -e 's/([^:]+):([^:]+):([^:]+):.*/\3/')" + if [ -n "$SGID" ] && [ "$SGID" -ge "1000" ]; then + SUSR="$(grep ^mlmmj: /etc/group | sed -r -e 's/([^:]+):([^:]+):([^:]+):(.*)$/\4/' -e 's/,/ /g')" + delgroup --quiet mlmmj + fi + + if ! getent group mlmmj > /dev/null; then + addgroup --system --quiet mlmmj + fi + + # Restore group membership to users in old user group (if any) + for user in $SUSR; do + adduser $user mlmmj + done + + # Create dedicated mlmmj user + if ! getent passwd mlmmj > /dev/null; then + adduser --system --quiet \ + --home /var/spool/mlmmj --no-create-home \ + --shell /bin/false --ingroup mlmmj \ + --gecos "Mailing List Management Made Joyful" \ + mlmmj + fi + # Unlock account in case it was locked from previous purge. + usermod -U -e '' mlmmj || true + + mkdir -p /var/spool/mlmmj + chown -R mlmmj:mlmmj /var/spool/mlmmj + chmod 02770 /var/spool/mlmmj + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. #DEBHELPER# +exit 0 diff --git a/debian/mlmmj.postrm b/debian/mlmmj.postrm index cfdcd4e..b2f2b76 100644 --- a/debian/mlmmj.postrm +++ b/debian/mlmmj.postrm @@ -1,34 +1,47 @@ #!/bin/sh +# postrm script for mlmmj +# +# see: dh_installdeb(1) + set -e +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> +# for details, see /usr/share/doc/packaging-manual/ + case "$1" in - purge) - if [ -e /usr/share/debconf/confmodule ] - then - . /usr/share/debconf/confmodule - db_get mlmmj/remove-on-purge || true - if [ "$RET" = "true" ] - then - echo "Removing /var/spool/mlmmj and /etc/mlmmj/lists." - rm -rf /var/spool/mlmmj /etc/mlmmj/lists > /dev/null - fi - db_purge || true - fi - if grep -qs '/usr/bin/mlmmj' /etc/aliases - then - echo "Warning /etc/aliases appears to contain references to mlmmj." >&2 - fi - ;; - - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade) + + ;; + + purge|disappear) + + # Lock mlmmj account. + usermod -L -e 1 mlmmj || true + + # not removing anything else + + ;; *) + echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; + exit 0 + + ;; esac +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + #DEBHELPER# exit 0 diff --git a/debian/patches/mlmmj_user_added b/debian/patches/mlmmj_user_added new file mode 100644 index 0000000..92f148a --- /dev/null +++ b/debian/patches/mlmmj_user_added @@ -0,0 +1,36 @@ +Description: mlmmj user is created +Author: Geert Stappers <stapp...@debian.org> +Bug-Debian: https://bugs.debian.org/862258 +Origin: vendor +Forwarded: no +Last-Update: 2017-05-15 + + +Index: mlmmj/README.exim4 +=================================================================== +--- mlmmj.orig/README.exim4 ++++ mlmmj/README.exim4 +@@ -9,6 +9,7 @@ of this can be found on http://plonk.de/ + + Notes: + - We assume that you have a user and group called mlmmj to use with mlmmj ++ (FYI: it is done by the .deb package) + - The exim user needs rx access rights to mlmmj's spool directory. (If you + don't want that, see below.) The easiest way is + "chmod 755 /path/to/mlmmj/spool", if it's ok that local users can see which +Index: mlmmj/README.postfix +=================================================================== +--- mlmmj.orig/README.postfix ++++ mlmmj/README.postfix +@@ -23,9 +23,11 @@ Postfix virtual domains (so you can host + makes sense to make this a 'system' user, with no password and no shell + (/usr/false for the shell), and for its home directory to be + /var/spool/mlmmj (or wherever you want to put your Mlmmj spool directory). ++ This is done by the packaging system. + + 2) Create your Mlmmj spool directory (we'll assume it's /var/spool/mlmmj) + and change its owner to the 'mlmmj' user. ++ This is done by the packaging system. + + 3) Add an 'mlmmj' transport which uses the pipe(8) delivery agent to execute + mlmmj-receive as the mlmmj user by adding something like the following to diff --git a/debian/patches/series b/debian/patches/series index c6f710e..3da5b8f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ fixes-path-to-templates-folder-in-php-web-admin 06_fix-php-web-for-php7.diff 07_fix-crontab-suggestions.diff +mlmmj_user_added -- 1.7.10.4 -- Groeten Geert Stappers -- Leven en laten leven