]> piware.de Git - bin.git/blob - postinst-setup
postinst-setup: stop restoring users from /etc bzr, set them up manually
[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 # 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 
11
12 # root's ssh stuff
13 if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
14     mkdir -p /root/.ssh
15     chmod 700 /root/.ssh
16     cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
17 fi
18
19 # restore /etc bzr branch, rescue the files we do not want to restore
20 # completely
21 cd /etc
22 if [ ! -d /etc/.bzr ]; then
23     [ -e /backup-etc ] || bzr branch bzr+ssh://martin@piware.de/home/martin/backup/`hostname`-etc /backup-etc
24     cp -av /backup-etc/* /etc/
25     cp -av /backup-etc/.bzr/ /etc/
26     rm -rf /backup-etc
27     chmod 600 /etc/ssh/ssh_*_key
28     chmod 700 /etc/ssl/private
29     chmod 640 /etc/ssl/private/ssl-cert-*
30     chown root:ssl-cert /etc/ssl/private/ssl-cert*
31 fi
32
33 # update postfix for new configuration
34 newaliases
35 /etc/init.d/postfix restart
36
37 # other setup
38 dpkg -i /home/martin/download/libdvdcss2_*amd64.deb || true
39 locale-gen ru_RU ru_RU.UTF-8
40
41 # remove packages that we do not need
42 killall apt-get || true # cronjob goo
43 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
44
45 #rm -f /etc/rcS.d/*pcmcia* /etc/rcS.d/*ppp*
46
47 # install packages from network sources
48 killall apt-get || true
49 apt-get update
50
51 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
52
53 apt-get -y --no-install-recommends build-dep postgresql-9.1 apport calibre gvfs udisks2 upower gnome-disk-utility udev pygobject
54
55 # have schroot use tmpfs
56 rmdir /var/lib/schroot/unpack /var/lib/schroot/union/overlay/
57 ln -s /tmp /var/lib/schroot/unpack
58 ln -s /tmp /var/lib/schroot/union/overlay
59
60 # set up users
61 echo "Setting up users"
62 adduser martin sbuild
63 if ! getent passwd joe > /dev/null; then
64     adduser --gecos "Joe" joe
65     adduser joe audio
66 fi
67
68 # crontabs
69 crontab -u martin - <<EOF
70 # m h  dom mon dow   command
71 05 * * * * \$HOME/bin/backup >/dev/null
72 EOF