Verified Commit 036902fe authored by mirabilos's avatar mirabilos Committed by mirabilos

extract system user (and group) creation into a separate script,

which I’ll gladly maintain, to reduce postinst complexity
parent 7463f744
......@@ -13,8 +13,9 @@ tomcat9 (9.0.16-4) unstable; urgency=medium
a suitable GC automatically anyway (Closes: #925928)
* Correct the ownership and permissions on the log directory:
group adm and setgid (Closes: #925929)
* Reduce postinst complexity: extract user creation into separate script
-- Thorsten Glaser <tg@mirbsd.de> Mon, 01 Apr 2019 17:16:06 +0200
-- Thorsten Glaser <tg@mirbsd.de> Tue, 02 Apr 2019 16:42:56 +0200
tomcat9 (9.0.16-3) unstable; urgency=medium
......
#!/bin/sh
#
# Create the tomcat system user
#
set -e
if id tomcat >/dev/null 2>&1; then
# The user already exists
exit 0
fi
if which systemd-sysusers >/dev/null; then
# Use /usr/lib/sysusers.d/tomcat9.conf and systemd
systemd-sysusers
else
# Use adduser instead, takes care of user and group both
adduser --system --home /var/lib/tomcat9 \
--shell /usr/sbin/nologin --no-create-home \
--group --disabled-password --disabled-login \
--gecos 'Apache Tomcat' tomcat
fi
......@@ -8,6 +8,7 @@ debian/default.template /usr/share/tomcat9/
debian/logrotate.template /usr/share/tomcat9/
debian/sysusers/*.conf /usr/lib/sysusers.d/
debian/libexec/create-sysuser.sh /usr/libexec/tomcat9/
debian/libexec/sysv-* /usr/libexec/tomcat9/
debian/libexec/tomcat-start.sh /usr/libexec/tomcat9/
debian/libexec/tomcat-update-policy.sh /usr/libexec/tomcat9/
......@@ -13,18 +13,8 @@ CONFFILES="tomcat-users.xml web.xml server.xml logging.properties context.xml ca
case "$1" in
configure)
if which systemd-sysusers >/dev/null; then
# Create the tomcat user as defined in /usr/lib/sysusers.d/tomcat9.conf
systemd-sysusers
elif id tomcat >/dev/null 2>&1; then
: The tomcat user already exists
else
# Create the tomcat user without systemd
adduser --system --home /var/lib/tomcat9 \
--shell /usr/sbin/nologin --no-create-home \
--group --disabled-password --disabled-login \
--gecos 'Apache Tomcat' tomcat
fi
# Create the tomcat user
/usr/libexec/tomcat9/create-sysuser.sh
# Install the configuration files
for conffile in $CONFFILES;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment