Просмотр исходного кода

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 <costela@debian.org>
Raphaël Hertzog лет назад: 17
Родитель
Сommit
6c785595d1
4 измененных файлов с 20 добавлено и 1 удалено
  1. 5 0
      debian/changelog
  2. 10 0
      debian/dpkg.cron.daily
  3. 2 1
      debian/rules
  4. 3 0
      man/dpkg.1

+ 5 - 0
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 <costela@debian.org> for the patch. Closes: #541412
 
   [ Modestas Vainius ]
   * Provide a meaningful label for dpkg-gensymbols diff.

+ 10 - 0
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
+

+ 2 - 1
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

+ 3 - 0
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: