From: Andrew Ruthven Date: Thu, 26 Apr 2012 00:09:24 +0000 (+1200) Subject: Take a snapshot of dpkg and debconf. X-Git-Tag: v0.2~5 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0aee7a97d09262671353086179965f4c4cbf15fe;p=etc-obnam.git Take a snapshot of dpkg and debconf. --- diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..68f017f --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +/var/lib/etc-obnam diff --git a/run-backup b/run-backup index 0db7712..43cd3ce 100755 --- a/run-backup +++ b/run-backup @@ -4,6 +4,7 @@ CLIENT=$(hostname) SOURCE=${SOURCE:-/home /etc} +WORKDIR=/var/lib/etc-obnam function check_host() { local type=$1 @@ -50,9 +51,30 @@ function check_host() { return 0 } +function capture_debconf_info() { + # Keep a list of the installed files + dpkg --get-selections > $WORKDIR/installed.packages.new + if [ $? -eq 0 ]; then + mv $WORKDIR/installed.packages.new $WORKDIR/installed.packages + else + rm -f $WORKDIR/installed.packages.new + fi + + # Dump out the debconf database + debconf-get-selections > $WORKDIR/debconf.dump.new + if [ $? -eq 0 ]; then + mv $WORKDIR/debconf.dump.new $WORKDIR/debconf.dump + else + rm -f $WORKDIR/debconf.dump.new + fi +} + + if ( check_host 'AAAA' -o check_host 'A' ) then - obnam --quiet --client-name=$CLIENT backup $SOURCE + capture_debconf_info + + obnam --quiet --client-name=$CLIENT backup $WORKDIR $SOURCE exit 0 else echo huh, where is it?