[Pkg-ceph-commits] [ceph] 01/03: Tweak move around of files to ensure nothing end-user created gets deleted

James Downing Page jamespage at moszumanska.debian.org
Mon Jun 13 11:03:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

jamespage pushed a commit to branch ubuntu-xenial
in repository ceph.

commit d7cb4f20c28a329cade991fcd886608b391ddeb2
Author: James Page <james.page at ubuntu.com>
Date:   Mon Jun 13 11:22:44 2016 +0100

    Tweak move around of files to ensure nothing end-user created gets deleted
    
    (cherry picked from commit 4bfc9a2e24354109618ca755da664085b41da929)
---
 debian/ceph-common.postinst | 13 +++++++------
 debian/ceph-common.postrm   |  6 ++++--
 debian/ceph-common.preinst  |  4 +++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/debian/ceph-common.postinst b/debian/ceph-common.postinst
index 791b4a2..90f318b 100644
--- a/debian/ceph-common.postinst
+++ b/debian/ceph-common.postinst
@@ -34,8 +34,10 @@ set -e
 # Groups that the user will be added to, if undefined, then none.
 [ -z "$SERVER_ADDGROUP" ] && SERVER_ADDGROUP=
 
+# Custom dpkg-maintscript-helper type function to deal with
+# nested /etc/default/ceph/ceph
 finish_mv_ceph_defaults() {
-    rm -rf "/etc/default/ceph.dpkg-remove"
+    rm -rf "/etc/default/ceph/ceph.dpkg-remove"
 
     [ -e "/etc/default/ceph/ceph" ] || return 0
 
@@ -43,11 +45,10 @@ finish_mv_ceph_defaults() {
     if [ -f "/etc/default/ceph" ]; then
         mv -f "/etc/default/ceph" "/etc/default/ceph.dpkg-new"
     fi
-    # Move ceph default file via staging location to allow deletion
-    # of nested ceph directory
-    mv -f "/etc/default/ceph/ceph" "/etc/default/ceph.dpkg-staging"
-    rm -rf "/etc/default/ceph"
-    mv -f "/etc/default/ceph.dpkg-staging" "/etc/default/ceph"
+    # Preserve /etc/default/ceph directory just in case users
+    # have added additional files to it.
+    mv -f "/etc/default/ceph" "/etc/default/ceph.dpkg-old"
+    mv -f "/etc/default/ceph.dpkg-old/ceph" "/etc/default/ceph"
 }
 
 case "$1" in
diff --git a/debian/ceph-common.postrm b/debian/ceph-common.postrm
index 25769c5..0236ba1 100644
--- a/debian/ceph-common.postrm
+++ b/debian/ceph-common.postrm
@@ -19,10 +19,12 @@ set -e
 # the debian-policy package
 
 
+# Custom dpkg-maintscript-helper type function to deal with
+# nested /etc/default/ceph/ceph
 abort_mv_ceph_defaults() {
-    if [ -e "/etc/default/ceph.dpkg-remove" ]; then
+    if [ -e "/etc/default/ceph/ceph.dpkg-remove" ]; then
         echo "Reinstalling /etc/default/ceph/ceph that was moved away"
-        mv "/etc/default/ceph.dpkg-remove" "/etc/default/ceph"
+        mv "/etc/default/ceph/ceph.dpkg-remove" "/etc/default/ceph/ceph"
     fi
 }
 
diff --git a/debian/ceph-common.preinst b/debian/ceph-common.preinst
index c56a850..7ed17fb 100644
--- a/debian/ceph-common.preinst
+++ b/debian/ceph-common.preinst
@@ -2,13 +2,15 @@
 
 set -e
 
+# Custom dpkg-maintscript-helper type function to deal with
+# nested /etc/default/ceph/ceph
 prepare_mv_ceph_defaults() {
     local md5sum old_md5sum
     md5sum="$(md5sum "/etc/default/ceph/ceph" | sed -e 's/ .*//')"
     old_md5sum="$(dpkg-query -W -f='${Conffiles}' "ceph-common" | \
         sed -n -e "\'^ /etc/default/ceph/ceph ' { s/ obsolete$//; s/.* //; p }")"
     if [ "$md5sum" = "$old_md5sum" ]; then
-        mv -f "/etc/default/ceph" "/etc/default/ceph.dpkg-remove"
+        mv -f "/etc/default/ceph/ceph" "/etc/default/ceph/ceph.dpkg-remove"
     fi
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ceph/ceph.git



More information about the Pkg-ceph-commits mailing list