3 # postinst script for ceph-mds
5 # see: dh_installdeb(1)
9 # summary of how this script can be called:
11 # postinst configure <most-recently-configured-version>
12 # old-postinst abort-upgrade <new-version>
13 # conflictor's-postinst abort-remove in-favour <package> <new-version>
14 # postinst abort-remove
15 # deconfigured's-postinst abort-deconfigure in-favour <failed-install-package> <version> [<removing conflicting-package> <version>]
18 # for details, see http://www.debian.org/doc/debian-policy/ or
19 # the debian-policy package
22 # Let the admin override these distro-specified defaults. This is NOT
24 [ -f "/etc/default/ceph" ] && .
/etc
/default
/ceph
26 [ -z "$SERVER_HOME" ] && SERVER_HOME
=/var
/lib
/ceph
27 [ -z "$SERVER_USER" ] && SERVER_USER
=ceph
28 [ -z "$SERVER_NAME" ] && SERVER_NAME
="Ceph storage service"
29 [ -z "$SERVER_GROUP" ] && SERVER_GROUP
=ceph
30 [ -z "$SERVER_UID" ] && SERVER_UID
=64045 # alloc by Debian base-passwd maintainer
31 [ -z "$SERVER_GID" ] && SERVER_GID
=$SERVER_UID
34 # Groups that the user will be added to, if undefined, then none.
35 [ -z "$SERVER_ADDGROUP" ] && SERVER_ADDGROUP
=
39 # create user to avoid running server as root
40 # 1. create group if not existing
41 if ! getent group |
grep -q "^$SERVER_GROUP:" ; then
42 echo -n "Adding group $SERVER_GROUP.."
43 addgroup
--quiet --system --gid $SERVER_GID \
44 $SERVER_GROUP 2>/dev
/null ||true
47 # 2. create user if not existing
48 if ! getent passwd |
grep -q "^$SERVER_USER:"; then
49 echo -n "Adding system user $SERVER_USER.."
56 $SERVER_USER 2>/dev
/null || true
59 # 3. adjust passwd entry
60 echo -n "Setting system user $SERVER_USER properties.."
61 usermod
-c "$SERVER_NAME" \
65 # Unlock $SERVER_USER in case it is locked from an uninstall
66 if [ -f /etc
/shadow
]; then
67 usermod
-U -e '' $SERVER_USER
69 usermod
-U $SERVER_USER
73 # 5. adjust file and directory permissions
74 if ! dpkg-statoverride
--list $SERVER_HOME >/dev
/null
76 chown
$SERVER_USER:$SERVER_GROUP $SERVER_HOME
77 chmod u
=rwx
,g
=rx
,o
= $SERVER_HOME
79 if ! dpkg-statoverride
--list /var
/log
/ceph
>/dev
/null
81 # take care not to touch cephadm log subdirs
82 chown
$SERVER_USER:$SERVER_GROUP /var
/log
/ceph
83 chown
$SERVER_USER:$SERVER_GROUP /var
/log
/ceph
/*.log
* || true
84 # members of group ceph can log here, but cannot remove
85 # others' files. non-members cannot read any logs.
86 chmod u
=rwx
,g
=rwxs
,o
=t
/var
/log
/ceph
89 # 6. fix /var/run/ceph
90 if [ -d /var
/run
/ceph
]; then
91 echo -n "Fixing /var/run/ceph ownership.."
92 chown
$SERVER_USER:$SERVER_GROUP /var
/run
/ceph
96 # create /run/ceph. fail softly if systemd isn't present or
98 [ -x /bin
/systemd-tmpfiles
] && systemd-tmpfiles
--create || true
100 abort-upgrade|abort-remove|abort-deconfigure
)
105 echo "postinst called with unknown argument \`$1'" >&2
110 # dh_installdeb will replace this with shell code automatically
111 # generated by other debhelper scripts.