Verified Commit ca0f08fc authored by mirabilos's avatar mirabilos Committed by mirabilos

Revert "extract system user … creation into a separate script":

In the discussion around it, ebourg indicated that he prefers
the inline code over a separate script, if it needs to be present
at all (which IMHO is necessary).

I kept the “do nothing if the user exists” check first, though;
there’s no need to try to create it over and over on every upgrade.

This reverts commit 036902fe
and c8966d77.
parent 253f2735
......@@ -13,9 +13,8 @@ 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> Tue, 02 Apr 2019 16:55:12 +0200
-- Thorsten Glaser <tg@mirbsd.de> Tue, 02 Apr 2019 22:54:17 +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,7 +8,6 @@ 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/
# handled in dependencies and maintainer script as alternative
tomcat9: maintainer-script-needs-depends-on-adduser postinst
......@@ -12,8 +12,19 @@ CONFFILES="tomcat-users.xml web.xml server.xml logging.properties context.xml ca
case "$1" in
configure)
# Create the tomcat user
/usr/libexec/tomcat9/create-sysuser.sh
# Check whether the tomcat user needs to be created
if id tomcat >/dev/null 2>&1; then
: no, it already exists
elif which systemd-sysusers >/dev/null; then
# Create the tomcat user as defined in /usr/lib/sysusers.d/tomcat9.conf
systemd-sysusers
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
# 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