From ee178fba4938d9b363a2fc245a06f627c5d104ee Mon Sep 17 00:00:00 2001 From: Gary Lowell Date: Thu, 14 Mar 2013 22:54:05 -0700 Subject: [PATCH] ceph.spec.in: Additional clean-up on package removal When removing the last instance of ceph, also remove the files created by ceph during operation. These consist of the files under /var/lib/ceph, /etc/ceph, and /var/log/ceph. Bug #4415. Signed-off-by: Gary Lowell Reviewed-by: Sage Weil --- ceph.spec.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ceph.spec.in b/ceph.spec.in index 7f9ee6da8c6ae..30e821e153ed5 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -346,6 +346,20 @@ fi %restart_on_update ceph %insserv_cleanup %endif +# Package removal cleanup +if [ "$1" -eq "0" ] ; then + + # be a little careful, here: unmount anything beneath here before removing it. + rm -rf --one-file-system -- /var/lib/ceph || true + if [ -d /var/lib/ceph ]; then + find /var/lib/ceph -mindepth 1 -maxdepth 2 -type d -exec umount \{\} \; + fi + rm -rf --one-file-system -- /var/lib/ceph + + # Other Ceph directories + rm -rf /var/log/ceph + rm -rf /etc/ceph +fi ################################################################################# # files -- 2.39.5