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" \
67 # 5. adjust file and directory permissions
68 if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
70 chown $SERVER_USER:$SERVER_GROUP $SERVER_HOME
71 chmod u=rwx,g=rx,o= $SERVER_HOME
73 if ! dpkg-statoverride --list /var/log/ceph >/dev/null
75 chown -R $SERVER_USER:$SERVER_GROUP /var/log/ceph
76 # members of group ceph can log here, but cannot remove
77 # others' files. non-members cannot read any logs.
78 chmod u=rwx,g=rwxs,o=t /var/log/ceph
81 # 6. fix /var/run/ceph
82 if [ -d /var/run/ceph ]; then
83 echo -n "Fixing /var/run/ceph ownership.."
84 chown $SERVER_USER:$SERVER_GROUP /var/run/ceph
88 # create /run/ceph. fail softly if systemd isn't present or
90 [ -x /bin/systemd-tmpfiles ] && systemd-tmpfiles --create || true
92 abort-upgrade|abort-remove|abort-deconfigure)
97 echo "postinst called with unknown argument \`$1'" >&2
102 # dh_installdeb will replace this with shell code automatically
103 # generated by other debhelper scripts.