]> piware.de Git - bin.git/commitdiff
pre/post inst: save /var/backups/martin to /home/martin/backup
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 9 Aug 2007 09:01:15 +0000 (11:01 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 9 Aug 2007 09:01:15 +0000 (11:01 +0200)
postinst-setup
preinst-backup

index d55fb4b7ad9f6f241e1debef1877a4fc4b25a3d4..25b174759541ad750a007c27c76b64c943222c7e 100755 (executable)
@@ -1,5 +1,10 @@
 #!/bin/sh -e
 
+# move backup to /var
+if [ -d /home/martin/backup ] && [ ! -d /var/backups/martin ]; then
+    cp -a /home/martin/backup /var/backups/martin
+fi
+
 # install already shipped debs
 [ -e /mirror ] || ln -s /home/ubuntu-mirror /mirror
 mount -o loop /home/martin/download/ubuntu/gutsy-alternate-amd64.iso /cdrom
@@ -81,5 +86,5 @@ ifup eth1
 # crontabs
 crontab -u martin - <<EOF
 # m h  dom mon dow   command
-05 * * * * \$HOME/bin/backup
+05 * * * * \$HOME/bin/backup >/dev/null
 EOF
index 68df29bf2b97a1403712fe0f83e63ec338b3c4b5..084f6596dfd1f422f76fe603ed81f2ccfd445eff 100755 (executable)
@@ -8,12 +8,12 @@ fi
 # push /etc/
 (cd /etc; HOME=/root bzr push)
 
-CURBACKUP=`ls -t /var/backups/pibackup/full* | head -n 1`
-[ -e "$CURBACKUP" ] || {
-    echo no current full backup in /var/backups/pibackup
+# copy backup to ~
+if [ -d /home/martin/backup ]; then
+    echo "/home/martin/backup exists already, aborting" >&2
     exit 1
-}
-cp $CURBACKUP /home/
+fi
+cp -a /var/backups/martin/ /home/martin/backup
 
 apt-get autoclean
 mkdir -p /home/aptcache