]> piware.de Git - bin.git/blob - postinst-setup
postinst-setup: keep network-manager for dogfooding
[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 [ -e /mirror ] || ln -s /home/ubuntu-mirror /mirror
11 mount -o loop /home/martin/download/ubuntu/gutsy-alternate-amd64.iso /cdrom
12 apt-cdrom -m add
13 DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential fakeroot devscripts postfix openssh-server bzr
14
15 # root's ssh stuff
16 if [ ! -d /root/ssh ]; then
17     mkdir -p /root/.ssh
18     chmod 700 /root/.ssh
19     cp /home/martin/.ssh/id_dsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
20 fi
21
22 # restore /etc bzr branch, rescue the files we do not want to restore
23 # completely
24 cd /etc
25 if [ ! -d /etc/.bzr ]; then
26     for i in passwd group shadow fstab; do
27         cp $i $i.originst
28     done
29     bzr get bzr+ssh://martin@piware.de/home/martin/backup/desktop-etc /desktop-etc
30     cp -av /desktop-etc/* /etc/
31     cp -av /desktop-etc/.bzr/ /etc/
32     rm -rf /desktop-etc
33     chmod 600 /etc/ssh/ssh_*_key
34 fi
35
36 # only restore dchroot part into fstab
37 grep -A 200 "^# dchroots" fstab >> fstab.originst
38 mv fstab.originst fstab
39
40 # only restore the human users from passwd/group
41 for i in passwd group; do
42     perl -naF: -e 'print if $F[2] > 1000 && $F[2] < 60000' $i >> $i.originst
43     mv $i.originst $i
44 done
45
46 # only restore some passwords from shadow
47 egrep 'martin|netti|test|joe' shadow >> shadow.originst
48 mv shadow.originst shadow
49
50 # update postfix for new configuration
51 newaliases
52 /etc/init.d/postfix restart
53
54 # copy apt cache
55 if [ -d /home/aptcache ]; then
56     find /home/aptcache/ -name "*.deb" -exec cp '{}' /var/cache/apt/archives/ \;
57     rm -rf /home/aptcache
58 fi
59
60 # other setup
61 dpkg -i /home/martin/download/libdvdcss2_*deb || true
62 locale-gen ru_RU ru_RU.UTF-8
63
64 # cronjob goo
65 killall apt-get || true
66
67 # remove packages that we do not need
68 apt-get remove --purge -y --auto-remove hplip brltty bluez-cups gnome-accessibility-themes gnome-mag gnome-orca onboard tomboy ttf-arabeyes ttf-arphic-ukai ttf-arphic-uming ttf-baekmuk ttf-gentium ttf-indic-fonts ttf-kochi-gothic ttf-kochi-mincho ttf-lao ttf-malayalam-fonts ttf-mgopen ttf-thai-tlwg
69
70 rm /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp*
71
72 # cronjob goo
73 killall apt-get || true
74
75 # install packages from network sources
76 apt-get update -o Acquire::Http::No-Cache=true
77
78 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes vim bzrtools bzr-svn python-paramiko patchutils offlineimap wipe gnome-gpg diffstat dchroot gtimelog rsnapshot 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 dhcp3-server grep-dctrl ccache subversion listadmin quilt apache2 python-dev cryptsetup mutt editmoin lintian ia32-libs easytag latex-beamer python-gtk2-doc
79 apt-get -y build-dep postgresql-8.2 gnome-volume-manager hal cupsys apport restricted-manager
80
81 umount /cdrom
82
83 # other setup
84 ln -s /mirror /var/www/mirror
85 ifdown eth1
86 ifup eth1
87 /etc/init.d/dhcp3-server restart
88 patch /usr/bin/gtimelog ~martin/archiv/gtimelog.wednesday.patch
89
90 # crontabs
91 crontab -u martin - <<EOF
92 # m h  dom mon dow   command
93 05 * * * * \$HOME/bin/backup >/dev/null
94 EOF