Bug#1030923: [PATCH] debian/postinst: Use '--force-badname' option if 'adduser' package version is below '3.122'.
Daniel Teichmann
daniel.teichmann at das-netzwerkteam.de
Thu Feb 9 11:25:49 GMT 2023
Otherwise use '--allow-bad-names' option (if adduser version is new enough).
Fixes: https://bugs.debian.org/1030923
---
debian/postinst | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/debian/postinst b/debian/postinst
index bd92aa1..56c44ce 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -23,10 +23,18 @@ case "${1}" in
# setup mDNS Reflector system user account
if ! getent 'passwd' '_mdns.reflector' >'/dev/null'; then
echo 'Creating _mdns.reflector system user.' >&2
+ # if adduser >= 3.122; then use --allow-bad-names
+ # if not; then use --force-badname
+ badname_option="--allow-bad-names"
+ version=`dpkg-query --show --showformat='${Version}' adduser`
+ if dpkg --compare-versions "$version" "lt" "3.122"; then
+ badname_option="--force-badname"
+ fi
+
adduser --system --no-create-home \
--disabled-password --disabled-login \
--shell /bin/false --group --home /dev/null \
- --allow-bad-names _mdns.reflector
+ "$badname_option" _mdns.reflector
fi
# Enable cap_net_raw+ep for the mdns-reflector binary
--
2.30.2
More information about the Debian-edu-pkg-team
mailing list