monotone-debian
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-debian] Patch: do not blindly delete /var/lib/monotone on purg


From: Ludovic Brenta
Subject: [Monotone-debian] Patch: do not blindly delete /var/lib/monotone on purge
Date: Fri, 13 Jul 2007 22:03:03 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Because the directory may contain other databases.  I just lost all of
my databases :/ luckily, monotone being distributed, I could restore
them quickly.  Still I'll have to fetch a couple of private databases
from backup.

Zack, looking at net.venge.monotone, I don't see how you create your
packages; the latest revision of the debian/ subdirectory also
contains source files much later than 0.35.  How do you do it?  Have
you got a private database for the debian scripts?  I would have
expected n.v.m to have several heads, one of which a direct descendent
of t:monotone-0.35, with only changes to the Debian scripts.

I'm ready to upload with the patch below.  Any objections?  Otherwise,
please apply it for future uploads.

-- 
Ludovic Brenta.


diff -ru ram/monotone-0.35/debian/changelog monotone-0.35/debian/changelog
--- ram/monotone-0.35/debian/changelog  2007-07-13 21:56:28.000000000 +0200
+++ monotone-0.35/debian/changelog      2007-07-13 20:05:33.189938318 +0200
@@ -5,6 +5,11 @@
   * Correct Ludovic Brenta's address in Uploaders.
   * Enable parallel make on multiprocessors.
 
+  [ Ludovic Brenta ]
+  * monotone-server.postrm: do not blindly erase /var/lib/monotone on
+    purge; instead, delete only the default database (created in the
+    postinst), and only delete the directory if empty.
+
  -- Zack Weinberg <address@hidden>  Fri, 13 Jul 2007 08:39:58 -0700
 
 monotone (0.35-1) unstable; urgency=low
diff -ru ram/monotone-0.35/debian/monotone-server.postrm 
monotone-0.35/debian/monotone-server.postrm
--- ram/monotone-0.35/debian/monotone-server.postrm     2007-05-07 
16:13:38.000000000 +0200
+++ monotone-0.35/debian/monotone-server.postrm 2007-07-13 21:38:51.472571896 
+0200
@@ -18,6 +18,9 @@
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+# source debconf stuff
+. /usr/share/debconf/confmodule
+
 case "$1" in
     purge)
        
@@ -25,6 +28,8 @@
        MTN_HOME=/var/lib/monotone
        MTN_CONFDIR=/etc/monotone
        MTN_KEYDIR=$MTN_HOME/keys
+       db_get monotone-server/key
+       MTN_KEY=$RET
 
        # remove configs from ucf database and filesystem
        /usr/bin/ucf --purge /etc/monotone/write-permissions
@@ -36,7 +41,7 @@
        rm -f /etc/monotone/hooks.lua || true
 
        if [ -n "`id -u monotone 2>/dev/null`" ]; then
-           /usr/sbin/deluser --quiet --remove-home monotone 2>/dev/null 
>/dev/null
+           /usr/sbin/deluser --quiet monotone 2>/dev/null >/dev/null
        fi
 
        if [ -n "`id -g monotone 2>/dev/null`" ]; then
@@ -44,7 +49,8 @@
        fi
        
        # delete the monotone database (only on purge)
-       rm -rf $MTN_HOME
+       rm -f $MTN_DB $MTN_HOME/keys/$MTN_KEY
+       rmdir --ignore-fail-on-non-empty $MTN_HOME/keys $MTN_HOME
 
     ;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
@@ -56,6 +62,9 @@
 
 esac
 
+# Stop debconf
+db_stop
+
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]