d/postfwd.postrm: detect existens of command by which and not 'test -x'

This commit is contained in:
Jan Wagner 2019-01-24 08:48:22 +01:00
parent ac0ac42ae2
commit e438455e0f

11
debian/postfwd.postrm vendored
View file

@ -27,14 +27,17 @@ case "$1" in
if USERID=`getent passwd $NUSER | cut -f 3 -d ':'`; then if USERID=`getent passwd $NUSER | cut -f 3 -d ':'`; then
if [ -n "$USERID" ]; then if [ -n "$USERID" ]; then
if [ "$FIST_SYSTEM_UID" -le "$USERID" ] && \ if [ "$FIST_SYSTEM_UID" -le "$USERID" ] && \
[ "$USERID" -le "$LAST_SYSTEM_UID" ] && \ [ "$USERID" -le "$LAST_SYSTEM_UID" ]; then
[ -x /usr/sbin/deluser ]; then if which deluser > /dev/null; then
deluser --quiet $NUSER || true deluser --quiet $NUSER || true
# And then remove the group # And then remove the group
GROUPID=`getent group $NGROUP | cut -f 3 -d ':'` GROUPID=`getent group $NGROUP | cut -f 3 -d ':'`
if [ -n "$GROUPID" ] && [ -x /usr/sbin/delgroup ] ; then if [ -n "$GROUPID" ]; then
delgroup --quiet $NGROUP || true if which delgroup > /dev/null; then
delgroup --quiet $NGROUP || true
fi
fi fi
fi
fi fi
fi fi
fi fi