4 if [ -d /home/martin/backup ] && [ ! -d /var/backups/martin ]; then
5 cp -a /home/martin/backup /var/backups/martin
6 rm -rf /home/martin/backup
9 # need bzr and postfix for the setup below
10 DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends postfix openssh-server bzr python-paramiko
13 if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
16 cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
19 # restore /etc bzr branch, rescue the files we do not want to restore
22 if [ ! -d /etc/.bzr ]; then
23 for i in passwd group shadow; do
24 [ -e $i.originst ] || cp $i $i.originst
26 [ -e /backup-etc ] || bzr branch bzr+ssh://martin@piware.de/home/martin/backup/`hostname`-etc /backup-etc
27 cp -av /backup-etc/* /etc/
28 cp -av /backup-etc/.bzr/ /etc/
30 chmod 600 /etc/ssh/ssh_*_key
32 chown root:shadow /etc/shadow
33 chmod 700 /etc/ssl/private
34 chmod 640 /etc/ssl/private/ssl-cert-*
35 chown root:ssl-cert /etc/ssl/private/ssl-cert*
37 # only restore the human users from passwd/group
38 for i in passwd group; do
39 perl -naF: -e 'print if $F[2] > 1000 && $F[2] < 60000' $i >> $i.originst
43 # only restore some passwords from shadow
44 egrep 'martin|netti|joe' shadow >> shadow.originst
45 mv shadow.originst shadow
46 chown root:shadow shadow
50 # update postfix for new configuration
52 /etc/init.d/postfix restart
55 dpkg -i /home/martin/download/libdvdcss2_*amd64.deb || true
56 locale-gen ru_RU ru_RU.UTF-8
58 # remove packages that we do not need
59 killall apt-get || true # cronjob goo
60 apt-get purge -y --auto-remove hplip hplip-data printer-driver-hpijs printer-driver-hpcups brltty bluez-cups gnome-accessibility-themes gnome-orca onboard thunderbird || true
62 #rm -f /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp*
64 # install packages from network sources
65 killall apt-get || true
68 DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y --force-yes vim patchutils offlineimap diffstat gtimelog libtool devhelp python3-doc manpages-dev weechat weechat-plugins weechat-scripts dpatch wdiff ccache listadmin quilt mutt editmoin lintian fakechroot ubuntu-dev-tools dput easytag rsnapshot texlive-lang-german texlive-latex-extra powertop qemu-kvm bzr-buildpackage git-core build-essential fakeroot devscripts libglib2.0-doc libgtk-3-doc git-buildpackage d-feet debootstrap wmctrl mumble libnotify-bin svn-buildpackage pastebinit lptools openvpn pdfjam sbuild schroot
70 apt-get -y --no-install-recommends build-dep postgresql-9.1 apport calibre gvfs udisks2 upower gnome-disk-utility udev pygobject
72 # have schroot use tmpfs
73 rmdir /var/lib/schroot/unpack /var/lib/schroot/union/overlay/
74 ln -s /tmp /var/lib/schroot/unpack
75 ln -s /tmp /var/lib/schroot/union/overlay
78 crontab -u martin - <<EOF
79 # m h dom mon dow command
80 05 * * * * \$HOME/bin/backup >/dev/null