]> piware.de Git - bin.git/blob - postinst-setup
pre/postinst: do not bother with apt cache any more, network is fast enough now
[bin.git] / postinst-setup
1 #!/bin/sh -e
2
3 # move backup to /var
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
7 fi
8
9 # install already shipped debs
10 UBUNTU_CD="/home/martin/download/ubuntu/`lsb_release -c`-alternate-`dpkg --print-architecture`.iso"
11 if [ -r "$UBUNTU_CD" ]; then
12     mount -o loop "$UBUNTU_CD" /cdrom
13     apt-cdrom -m add
14 fi
15 DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends build-essential fakeroot devscripts postfix openssh-server bzr python-paramiko 
16
17 # root's ssh stuff
18 if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
19     mkdir -p /root/.ssh
20     chmod 700 /root/.ssh
21     cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
22 fi
23
24 # restore /etc bzr branch, rescue the files we do not want to restore
25 # completely
26 cd /etc
27 if [ ! -d /etc/.bzr ]; then
28     #for i in passwd group shadow fstab; do
29     for i in fstab; do
30         [ -e $i.originst ] || cp $i $i.originst
31     done
32     [ -e /backup-etc ] || bzr get bzr+ssh://martin@piware.de/home/martin/backup/`hostname`-etc /backup-etc
33     cp -av /backup-etc/* /etc/
34     cp -av /backup-etc/.bzr/ /etc/
35     rm -rf /backup-etc
36     chmod 600 /etc/ssh/ssh_*_key
37     #chmod 640 /etc/shadow
38     #chown root:shadow /etc/shadow
39     chmod 700 /etc/ssl/private
40     chmod 640 /etc/ssl/private/ssl-cert-*
41     chown root:ssl-cert /etc/ssl/private/ssl-cert*
42
43     # only restore dchroot part into fstab
44     grep -A 200 "^#.*chroot" fstab >> fstab.originst || true
45     mv fstab.originst fstab
46
47     # only restore the human users from passwd/group
48     #for i in passwd group; do
49     #    perl -naF: -e 'print if $F[2] > 1000 && $F[2] < 60000' $i >> $i.originst
50     #    mv $i.originst $i
51     #done
52
53     # only restore some passwords from shadow
54     #egrep 'martin|netti|joe' shadow >> shadow.originst
55     #mv shadow.originst shadow
56     #chown root:shadow shadow
57     #chmod 640 shadow
58 fi
59
60 # update postfix for new configuration
61 newaliases
62 /etc/init.d/postfix restart
63
64 # other setup
65 dpkg -i /home/martin/download/libdvdcss2_*deb || true
66 locale-gen ru_RU ru_RU.UTF-8
67
68 # remove packages that we do not need
69 killall apt-get || true # cronjob goo
70 apt-get purge -y --auto-remove hplip brltty bluez-cups gnome-accessibility-themes gnome-mag gnome-orca onboard tomboy ttf-arabeyes ttf-arphic-uming ttf-lao ttf-thai-tlwg update-motd || true
71
72 rm -f /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp*
73
74 # install packages from network sources
75 killall apt-get || true
76 apt-get update -o Acquire::Http::No-Cache=true
77
78 DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y --force-yes vim bzrtools bzr-svn patchutils offlineimap wipe diffstat gtimelog jigdo-file libtool devhelp python-doc manpages-dev gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg weechat weechat-plugins weechat-scripts dpatch wdiff debian-goodies ccache subversion listadmin quilt python-dev cryptsetup mutt editmoin lintian python-gtk2-doc fakechroot ubuntu-dev-tools dput dchroot fakechroot imagemagick pngquant pdfjam easytag rsnapshot texlive-lang-german texlive-latex-extra python-coverage powertop sane-utils vim-scripts libtemplate-perl kvm bzr-buildpackage git-core greasemonkey
79 apt-get -y build-dep postgresql-8.4 hal cups apport jockey calibre gvfs devicekit-disks devicekit-power
80
81 umount /cdrom || true
82
83 # crontabs
84 crontab -u martin - <<EOF
85 # m h  dom mon dow   command
86 05 * * * * \$HOME/bin/backup >/dev/null
87 EOF
88
89 if [ -x /usr/bin/gtimelog ]; then
90     patch /usr/bin/gtimelog ~martin/archiv/gtimelog.tuesday.patch
91 fi