#!/bin/bash -e # # run this script as root, on deleuze, in a directory that WILL NOT be # part of the backup (/tmp is a good choice). # # FIXME: # postgres dumps # mysql dumps #KEYFILE=$1 KEYFILE=/etc/backup-encryption-key echo building package lists... dpkg -W -f='${Package}\n' > packages find / /usr/ /usr/local/ /var/ -xdev | sort | uniq > allfiles dpkg-query -W -f='${Package}\n' | xargs dpkg -L | sort | uniq > debfiles dpkg-query -W -f='${Conffiles}\n' | grep / | sort | uniq > conffiles diff allfiles debfiles | grep '^<' | cut -b 3- | \ grep -v ^/var/cache | \ grep -v ^/var/tmp | \ grep -v ^/var/lib/dpkg | \ grep -v ^/var/backups | \ grep -v ^/var/lib/changetrack | \ grep -v ^/var/run | \ grep -v ^/var/lock | \ grep -v ^/var/lib/ucf | \ grep -v ^/vicepa | \ grep -v ^/home | \ grep -v ^/tmp | \ grep -v '^/afs$' | \ grep -v '^/$' | \ grep -v '^/usr/$' | \ grep -v ^/usr/src | \ cat > backupfiles cat backupfiles | \ grep -v ^/home | \ grep -v ^/usr/local | \ grep -v ^/var/spool | \ grep -v ^/var/log | \ grep -v ^/usr/lib/python2.4/ | \ grep -v ^/var/lib/python-support | \ grep -v ^/usr/share/man | \ grep -v ^/media | \ grep -v ^/vmlinuz | \ grep -v ^/vmlinuz.old | \ grep -v '^/sbin/[a-z\-]*.modutils$' | \ cat > annoyingfiles- for A in `cat annoyingfiles-` do \ test -L "$A" || echo "$A" done > annoyingfiles cat annoyingfiles | \ grep -v ^/opt/dell/srvadmin/ | \ grep -v ^/boot/ | \ grep -v ^/etc/ | \ grep -v ^/root/ | \ grep -v ^/var/ | \ grep -v ^/lib/modules/ | \ grep -v ^/var/domtool/ | \ grep -v ^/var/lib/mysql/ | \ grep -v ^/var/lib/postgres/ | \ grep -v ^/var/lib/postgresql/ | \ cat > complain mail -a 'From: Adam Megacz ' \ -s "annoying files found on deleuze (please do something about them)" admins@hcoop.net \ < complain tar cvlpjf - -C / -T backupfiles | bzip2 | ccrypt -k $KEYFILE -e > hcoop.backup.tar.bz2.aescrypt du -chs hcoop.backup.tar.bz2.aescrypt vos listvol deleuze | tail -n +2 | head -n -3 | cut -b1-34 | grep -v "\.backup .*$" | grep -v "\.readonly .*$" > volumes for A in `cat volumes` do \ echo "dumping afs volume $A..." time vos dump -id $A -localauth -clone | bzip2 | ccrypt -k $KEYFILE -e > $A.dump.bz2.aescrypt done