Skip to content

Commit a1a8576

Browse files
committed
debian/ceph-common.postinst: set user directory using adduser
now that adduser allows us to set its home directory, we can do this using adduser instead of using usermod. this change also silences the warning from lintian "maintainer-script-lacks-home-in-adduser". lintian complains if `adduser --system` is called without passing `--home` option. also, take this opportunity to s/-c/--comment/ in the command line of `usermod`, for better readability. Fixes: https://tracker.ceph.com/issues/64069 Signed-off-by: Kefu Chai <[email protected]>
1 parent 2a30ddc commit a1a8576

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

debian/ceph-common.postinst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,20 @@ case "$1" in
5252
--system \
5353
--no-create-home \
5454
--disabled-password \
55+
--home $SERVER_HOME \
5556
--uid $SERVER_UID \
5657
--gid $SERVER_GID \
5758
$SERVER_USER 2>/dev/null || true
5859
echo "..done"
5960
fi
6061
# 3. adjust passwd entry
62+
# NOTE: we should use "adduser --comment" if we don't need to
63+
# support adduser <3.136. "adduser --gecos" is deprecated,
64+
# and will be removed, so we don't use it. the first distro
65+
# using --comment is debian/trixie or ubuntu/mantic.
6166
echo -n "Setting system user $SERVER_USER properties.."
62-
usermod -c "$SERVER_NAME" \
63-
-d $SERVER_HOME \
64-
-g $SERVER_GROUP \
67+
usermod --comment "$SERVER_NAME" \
68+
--gid $SERVER_GROUP \
6569
$SERVER_USER
6670
# Unlock $SERVER_USER in case it is locked from an uninstall
6771
if [ -f /etc/shadow ]; then

0 commit comments

Comments
 (0)