Skip to content

Commit d74e98d

Browse files
authored
Merge pull request ceph#55218 from tchaikov/debian/postinst
debian/*.postinst: add adduser as a dependency and specify --home when adduser Reviewed-by: Laura Flores <[email protected]> Reviewed-by: Adam King [email protected]
2 parents b9f000f + e74ec0b commit d74e98d

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
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

debian/cephadm.postinst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ case "$1" in
2525
# 1. create user if not existing
2626
if ! getent passwd | grep -q "^cephadm:"; then
2727
echo -n "Adding system user cephadm.."
28-
adduser --quiet --system --disabled-password --gecos 'cephadm user for mgr/cephadm' --shell /bin/bash cephadm 2>/dev/null || true
28+
adduser --quiet \
29+
--system \
30+
--disabled-password \
31+
--home /home/cephadm \
32+
--shell /bin/bash cephadm 2>/dev/null || true
33+
usermod --comment "cephadm user for mgr/cephadm" cephadm
2934
echo "..done"
3035
fi
3136

@@ -38,19 +43,19 @@ case "$1" in
3843

3944
# set up (initially empty) .ssh/authorized_keys file
4045
if ! test -d /home/cephadm/.ssh; then
41-
mkdir /home/cephadm/.ssh
42-
chown --reference /home/cephadm /home/cephadm/.ssh
43-
chmod 0700 /home/cephadm/.ssh
46+
mkdir /home/cephadm/.ssh
47+
chown --reference /home/cephadm /home/cephadm/.ssh
48+
chmod 0700 /home/cephadm/.ssh
4449
fi
4550
if ! test -e /home/cephadm/.ssh/authorized_keys; then
46-
touch /home/cephadm/.ssh/authorized_keys
47-
chown --reference /home/cephadm /home/cephadm/.ssh/authorized_keys
48-
chmod 0600 /home/cephadm/.ssh/authorized_keys
51+
touch /home/cephadm/.ssh/authorized_keys
52+
chown --reference /home/cephadm /home/cephadm/.ssh/authorized_keys
53+
chmod 0600 /home/cephadm/.ssh/authorized_keys
4954
fi
5055

5156
;;
5257
abort-upgrade|abort-remove|abort-deconfigure)
53-
:
58+
:
5459
;;
5560

5661
*)

debian/control

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ Description: debugging symbols for ceph-base
186186
Package: cephadm
187187
Architecture: linux-any
188188
Recommends: podman (>= 2.0.2) | docker.io | docker-ce
189-
Depends: lvm2,
189+
Depends: adduser (>= 3.11),
190+
lvm2,
190191
python3,
191192
${python3:Depends},
192193
Description: cephadm utility to bootstrap ceph daemons with systemd and containers
@@ -612,7 +613,8 @@ Description: debugging symbols for rbd-nbd
612613

613614
Package: ceph-common
614615
Architecture: linux-any
615-
Depends: librbd1 (= ${binary:Version}),
616+
Depends: adduser (>= 3.11),
617+
librbd1 (= ${binary:Version}),
616618
python3-cephfs (= ${binary:Version}),
617619
python3-ceph-argparse (= ${binary:Version}),
618620
python3-ceph-common (= ${binary:Version}),

0 commit comments

Comments
 (0)