The following commit has been merged in the master branch:
commit 6c785595d189f65a59284796a9b1f60f16686e85
Author: Raphaël Hertzog <[email protected]>
Date:   Fri Aug 14 21:41:44 2009 +0200

    Add a dpkg cron.daily script to backup the status file
    
    Create /etc/cron.daily/dpkg to handle the backup of /var/lib/dpkg/status
    in /var/backups. This is taken out of the cron package and need no
    conflicts/breaks as the code does nothing if the current status file is
    already backupped.
    
    Moving it out of the cron package makes it more visible for users
    inspecting the content of the dpkg package.
    
    Based-on-patch-by: Leo 'costela' Antunes <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index a3e10c8..a735e50 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -52,6 +52,11 @@ dpkg (1.15.4) UNRELEASED; urgency=low
     Millan for the patch. Closes: #537559
   * Update sample in dpkg-gensymbols(1) to give an accurate listing of
     64 bit arches. Thanks to Julien Cristau for the patch. Closes: #540382
+  * Create /etc/cron.daily/dpkg to handle the backup of
+    /var/lib/dpkg/status in /var/backups. This is taken out of the cron
+    package and need no conflicts/breaks as the code does nothing if
+    the current status file is already backupped. Thanks to Leo 'costela'
+    Antunes <[email protected]> for the patch. Closes: #541412
 
   [ Modestas Vainius ]
   * Provide a meaningful label for dpkg-gensymbols diff.
diff --git a/debian/dpkg.cron.daily b/debian/dpkg.cron.daily
new file mode 100644
index 0000000..99f4f6b
--- /dev/null
+++ b/debian/dpkg.cron.daily
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Backup the 7 last versions of dpkg's status file
+if cd /var/backups ; then
+    if ! cmp -s dpkg.status.0 /var/lib/dpkg/status ; then
+            cp -p /var/lib/dpkg/status dpkg.status
+            savelog -c 7 dpkg.status >/dev/null
+    fi
+fi
+
diff --git a/debian/rules b/debian/rules
index 05c08ca..b302e93 100755
--- a/debian/rules
+++ b/debian/rules
@@ -84,6 +84,7 @@ binary-arch: install
        dh_testdir -a
        dh_testroot -a
        dh_install --sourcedir=debian/tmp -a
+       dh_installcron -a
        dh_installlogrotate -a
 
        install -d debian/dpkg/sbin
@@ -107,7 +108,7 @@ binary-indep: install
        dh_testdir -i
        dh_testroot -i
        dh_install --sourcedir=debian/tmp -i -XDpkg/Gettext.pm
-
+       dh_installcron -i
        dh_installchangelogs -i ChangeLog*
        dh_installdocs -i
        dh_link -i
diff --git a/man/dpkg.1 b/man/dpkg.1
index 665519f..58a0915 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -577,6 +577,9 @@ Statuses of available packages. This file contains 
information about
 whether a package is marked for removing or not, whether it is
 installed or not, etc. See section \fBINFORMATION ABOUT PACKAGES\fP
 for more info.
+
+The status file is backed up daily in \fI/var/backups\fP. It can be
+useful if it's lost or corrupted due to filesystems troubles.
 .P
 The following files are components of a binary package. See \fBdeb\fP(5)
 for more information about them:

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to