#!/bin/sh set -e if ! getent passwd _debug-me >/dev/null; then # --force-badname needed until #521883 resolved adduser --system --group --disabled-login --disabled-password \ --home /var/log/debug-me --force-badname _debug-me fi mkdir -p /var/log/debug-me chmod 700 /var/log/debug-me chown _debug-me:_debug-me /var/log/debug-me # We don't need to chown the contents of /var/log/debug-me because the # postrm either removes both the _debug-me user and the # /var/log/debug-me directory, or removes neither of them. So we # cannot get a situation where there are log files in # /var/log/debug-me which need to be chowned to the UID of the new # _debug-me user. # # If the postrm is ever changed not to delete the logs in # /var/log/debug-me even on a package purge, but instead to chown them # to root, or similar, we would need something like the following # (untested): # # for f in /var/log/debug-me/*; do # if test -f "$f"; then # links="$(stat --format=%h \"$f\")" # if test $links -eq 1; then # chown _debug-me:_debug-me "$f" # fi # fi # done # # (`chown -R` should not be used -- see Lintian tag maintainer-script-should-not-use-recursive-chown-or-chmod) #DEBHELPER#