]> piware.de Git - bin.git/blob - postinst-setup
postinst-setup: do not fail if killing apt fails
[bin.git] / postinst-setup
1 #!/bin/sh -e
2
3 # install already shipped debs
4 [ -e /mirror ] || ln -s /home/ubuntu-mirror /mirror
5 mount -o loop /home/martin/download/ubuntu/feisty-alternate-amd64.iso /cdrom
6 apt-cdrom -m add
7 DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential fakeroot devscripts mutt postfix openssh-server
8
9 dpkg -i ~martin/download/afio*.deb || exit 1
10
11 # configuration files
12 mkdir -p /var/backups/pibackup/
13 [ -e /home/full*.cpio ] && mv /home/full*.cpio /var/backups/pibackup/ || true
14
15 CURBACKUP=`ls -t /var/backups/pibackup/full* | head -n 1`
16 [ -e "$CURBACKUP" ] || {
17     echo no current full backup in /var/backups/pibackup
18     exit 1
19 }
20 cd /
21 afio -iZ -y '/etc/*' -Y /etc/passwd -Y /etc/group -Y /etc/shadow -Y /etc/fstab $CURBACKUP
22
23 # only restore dchroot part into fstab
24 cd /tmp
25 afio -iZ -y /etc/fstab $CURBACKUP
26 grep -A 200 "^# dchroots" /tmp/etc/fstab >> /etc/fstab
27 rm -rf /tmp/etc
28
29 newaliases
30 /etc/init.d/postfix restart
31
32 # install users
33 cat <<EOF >> /etc/passwd
34 joe:x:1001:1001:Joe User,,,:/home/joe:/bin/bash
35 netti:x:1002:1002:Annett Kittel,,,:/home/netti:/bin/bash
36 EOF
37 cat <<EOF >> /etc/shadow
38 joe:$1$7t1pZTyL$lI7.B/9DtPa6y2BD8wTNZ/:13060:0:99999:7:::
39 netti:$1$5uq6X7u0$92yOfMH2Nh89Ui.hbaEDp/:12930:0:99999:7:::
40 EOF
41 cat <<EOF >> /etc/group
42 joe:x:1001:
43 netti:x:1002:
44 EOF
45
46 for g in cdrom audio video plugdev scanner; do
47     for u in joe netti; do
48         adduser $u $g
49     done
50 done
51
52 # root's ssh stuff
53 mkdir -p /root/.ssh
54 chmod 700 /root/.ssh
55 cp /home/martin/.ssh/id_dsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
56
57 # copy apt cache
58 if [ -d /home/aptcache ]; then
59     find /home/aptcache/ -name "*.deb" -exec cp '{}' /var/cache/apt/archives/ \;
60 fi
61
62 # other setup
63 dpkg -i /home/martin/download/libdvdcss2_*deb || true
64 locale-gen ru_RU ru_RU.UTF-8
65
66 # cronjob goo
67 killall apt-get || true
68
69 # remove packages that we do not need
70 apt-get remove --purge -y --auto-remove network-manager 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
71
72 rm /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp*
73
74 # restore our network
75 ifdown eth0 || true
76 ifup eth0
77
78 # install packages from network sources
79 apt-get update -o Acquire::Http::No-Cache=true
80
81 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes vim bzr bzrtools python-paramiko patchutils offlineimap wipe gnome-gpg diffstat dchroot gtimelog pibackup jigdo-file libtool devhelp python-doc perl-doc manpages-dev gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg xchat debmirror dpatch wdiff dhcp3-server grep-dctrl ccache subversion listadmin ia32-libs quilt apache2 python-dev cryptsetup
82 apt-get -y build-dep postgresql-8.1 gnome-volume-manager hal pmount cupsys
83
84 # other setup
85 ln -s /mirror /var/www/mirror
86 ifdown eth1
87 ifup eth1
88 /etc/init.d/dhcp3-server restart