From 0aee7a97d09262671353086179965f4c4cbf15fe Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Thu, 26 Apr 2012 12:09:24 +1200 Subject: [PATCH] Take a snapshot of dpkg and debconf. --- debian/dirs | 1 + run-backup | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 debian/dirs 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? -- 2.30.2