]> git.etc.gen.nz Git - etc-obnam.git/commitdiff
Take a snapshot of dpkg and debconf.
authorAndrew Ruthven <andrew@etc.gen.nz>
Thu, 26 Apr 2012 00:09:24 +0000 (12:09 +1200)
committerAndrew Ruthven <andrew@etc.gen.nz>
Thu, 26 Apr 2012 00:09:24 +0000 (12:09 +1200)
debian/dirs [new file with mode: 0644]
run-backup

diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..68f017f
--- /dev/null
@@ -0,0 +1 @@
+/var/lib/etc-obnam
index 0db7712379e6a5714e0c23d16ed6c339b5a004f6..43cd3ce8a6964a841cc3dea0629a856b0c1da841 100755 (executable)
@@ -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?