From: Caleb Boylan Date: Tue, 16 May 2017 17:40:10 +0000 (-0700) Subject: build/ops: Lock ceph user during a purge X-Git-Tag: v13.0.0~66^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=114f43a58a6831b6774eb57133d1012b3e588241;p=ceph.git build/ops: Lock ceph user during a purge Signed-off-by: Caleb Boylan --- diff --git a/debian/ceph-common.postinst b/debian/ceph-common.postinst index 719dc7908b95..b9d382aaaa91 100644 --- a/debian/ceph-common.postinst +++ b/debian/ceph-common.postinst @@ -62,6 +62,12 @@ case "$1" in -d $SERVER_HOME \ -g $SERVER_GROUP \ $SERVER_USER + # Unlock $SERVER_USER in case it is locked from an uninstall + if [ -f /etc/shadow ]; then + usermod -U -e '' $SERVER_USER + else + usermod -U $SERVER_USER + fi echo "..done" # 5. adjust file and directory permissions diff --git a/debian/ceph-common.postrm b/debian/ceph-common.postrm index b62185483cb6..e6a97543ac16 100644 --- a/debian/ceph-common.postrm +++ b/debian/ceph-common.postrm @@ -24,8 +24,17 @@ case "$1" in ;; purge) - rm -rf /var/log/ceph - rm -rf /etc/ceph + [ -f "/etc/default/ceph" ] && . /etc/default/ceph + [ -z "$SERVER_USER" ] && SERVER_USER=ceph + + rm -rf /var/log/ceph + rm -rf /etc/ceph + + if [ -f /etc/shadow ]; then + usermod -L -e 1 $SERVER_USER + else + usermod -L $SERVER_USER + fi ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)