From 6532e1c48656b37c59185cb7bd3840fac008050f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Apr 2015 10:28:31 -0700 Subject: [PATCH] debian: fix /var/lib/ceph/* directory ownership These dirs are owned by the package; make sure they are owend by the ceph user. Signed-off-by: Sage Weil --- debian/ceph-mds.postinst | 8 ++++++++ debian/ceph.postinst | 11 +++++++++++ debian/radosgw.postinst | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/debian/ceph-mds.postinst b/debian/ceph-mds.postinst index 66b3b5fc2d7..b69efedaafb 100644 --- a/debian/ceph-mds.postinst +++ b/debian/ceph-mds.postinst @@ -18,10 +18,18 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +[ -f "/etc/default/ceph" ] && . /etc/default/ceph +[ -z "$SERVER_USER" ] && SERVER_USER=ceph +[ -z "$SERVER_GROUP" ] && SERVER_GROUP=ceph case "$1" in configure) [ -x /sbin/start ] && start ceph-mds-all || : + + if ! dpkg-statoverride --list /var/lib/ceph/mds >/dev/null + then + chown $SERVER_USER:$SERVER_GROUP /var/lib/ceph/mds + fi ;; abort-upgrade|abort-remove|abort-deconfigure) : diff --git a/debian/ceph.postinst b/debian/ceph.postinst index 5d64f640b99..75eeb59c624 100644 --- a/debian/ceph.postinst +++ b/debian/ceph.postinst @@ -24,11 +24,22 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +[ -f "/etc/default/ceph" ] && . /etc/default/ceph +[ -z "$SERVER_USER" ] && SERVER_USER=ceph +[ -z "$SERVER_GROUP" ] && SERVER_GROUP=ceph case "$1" in configure) rm -f /etc/init/ceph.conf [ -x /sbin/start ] && start ceph-all || : + + # adjust file and directory permissions + for DIR in /var/lib/ceph/* ; do + if ! dpkg-statoverride --list $DIR >/dev/null + then + chown $SERVER_USER:$SERVER_GROUP $DIR + fi + done ;; abort-upgrade|abort-remove|abort-deconfigure) : diff --git a/debian/radosgw.postinst b/debian/radosgw.postinst index f3468bc60bf..07e3ec30b6d 100644 --- a/debian/radosgw.postinst +++ b/debian/radosgw.postinst @@ -24,10 +24,18 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +[ -f "/etc/default/ceph" ] && . /etc/default/ceph +[ -z "$SERVER_USER" ] && SERVER_USER=ceph +[ -z "$SERVER_GROUP" ] && SERVER_GROUP=ceph case "$1" in configure) [ -x /sbin/start ] && start radosgw-all || : + + if ! dpkg-statoverride --list /var/lib/ceph/radosgw >/dev/null + then + chown $SERVER_USER:$SERVER_GROUP /var/lib/ceph/radosgw + fi ;; abort-upgrade|abort-remove|abort-deconfigure) :