]> git.donarmstrong.com Git - neurodebian.git/blob - vm/d-i/tools/initial_setup
6875079b0bdfa592584262077ef76345f149511b
[neurodebian.git] / vm / d-i / tools / initial_setup
1 #!/bin/bash
2
3 # play safe
4 set -e
5 set -u
6
7 # Standard Debian install
8
9 # prepare on hydra and use debproxy for speed
10
11 # have dedicated hard-drives for swap and home
12
13 # expert install
14
15 # hostname: neurodebian
16 # domain: ''
17
18 # Needs to be assured since it got reset to debian
19 hostname neurodebian  # this is not a permanent change
20 echo "neurodebian" >| /etc/hostname  # make it permanent
21 sed -i -e 's/^127\.0\.1\.1.*/127.0.1.1\tneurodebian/g' /etc/hosts
22
23 # all file in one partition
24
25 # root: not there
26 # user: brain
27 # pwd: neurodebian
28
29
30 # Do a minimal install
31 # --------------------
32
33 # All files in one partition/
34 # just base system, run selection, but no tasks (not even 'Standard system')
35
36 # set root password to 'neurodebian' too
37 #echo "Set root passwd:"
38 #passwd root
39
40 apt-get install --no-install-recommends -y etckeeper
41
42 # setup etckeeper
43 git config --global user.name NeuroDebian
44 git config --global user.email nd@localhost
45
46 # install new stuff
47 # -----------------
48
49 # Add sources.list for backports and neurodebian
50 wget -O /etc/apt/sources.list.d/neuro.debian.net.list http://neuro.debian.net/lists/squeeze.us-nh
51
52 echo "deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free" > /etc/apt/sources.list.d/backports.debian.org.list
53 cat << EOT > /etc/apt/preferences.d/backports.debian.org.pref
54 Package: *
55 Pin: release a=squeeze-backports
56 Pin-Priority: 200
57 EOT
58
59 apt-get update -y
60 # Backports' Release files signed with both ftpmaster and old backports keys
61 # That causes APT to spit out a warning, but to not confuse users, lets simply
62 # obtain that key if possible
63 gpg --keyserver hkp://subkeys.pgp.net --recv-keys 16BA136C && \
64         gpg --export 16BA136C | apt-key add - || :
65
66 apt-get install -y --allow-unauthenticated neurodebian-keyring
67 apt-get update -y
68
69 # to cheat the VM check
70 touch /dev/vboxguest
71
72 # Assure that corresponding linux headers are installed since otherwise they
73 # might not be.  There is also a dichotomy between target 686 and installer
74 # using 486 build of the kernel.  It requires manual build/installation
75 # of guest additions for 686 at this point. Hence all the ugly logic below
76 cunamer=`uname -r`
77 cdarch=${cunamer##*-}
78 # We carry 686 only
79 [ $cdarch = '486' ] && darch='686' || darch=$cdarch
80 apt-get install -y linux-headers-2.6-$cdarch
81
82 # Forcefully install guest additions from backports so we are
83 # compatible with VirtualBox 4.x series
84 apt-get install -y -t squeeze-backports virtualbox-ose-guest-dkms \
85         virtualbox-ose-guest-utils  virtualbox-ose-guest-x11 \
86         >| /var/log/initial_setup-dkms.log 2>&1
87
88 # to get all the rest stuff in recommends
89 apt-get install -y dkms neurodebian-guest-additions
90
91 if [ "$darch" != "$cdarch" ] ; then
92     # Because DKMS builds for currently running kernel, which during
93     # installation might be a more generic 486, lets force building for 686
94         # and also install necessary headers (will be purged later on anyways)
95         apt-get install -y linux-headers-2.6-$darch
96
97         unamer=${cunamer//$cdarch/$darch}
98         # First collect information about installed vb additions
99         vbg=( `dkms status | grep virtualbox | head -n 1 | tr ',' ' '` )
100         echo "I: forcing build and install of guest additions for 686"
101         dkms build -m ${vbg[0]} -v ${vbg[1]} -a i686 -k $unamer \
102                 >| /var/log/initial_setup-dkms-686-build.log 2>&1
103         dkms install -m ${vbg[0]} -v ${vbg[1]} -a i686 -k $unamer \
104                 >| /var/log/initial_setup-dkms-686-install.log 2>&1
105 fi
106
107 # assure at the end that we got right modules build in the right location
108 find /lib/modules/*$darch -iname vboxsf.ko | grep -q .
109
110 apt-get install --no-install-recommends -y \
111  gnome-core mc evince bash-completion ntpdate file-roller gnome-utils \
112  gnome-themes eog vim reportbug \
113  software-center gdebi gedit-plugins gnome-media synaptic menu less libxp6
114
115 # Clean-up installed development files which got pulled in for
116 # VM guest additions (to build kernel modules via DKMS)
117 apt-get purge -y libc6-dev
118 dpkg -l | awk '/^ii.*[ \t]linux-headers/{print $2;}' | xargs -r apt-get purge -y
119
120 # Gnome optional pulled by gnome-core:
121 apt-get purge -y gnome-core evolution-common evolution libevolution
122
123 # And utter cleanup
124 apt-get -y autoremove
125
126 # intermediate cleanup to prevent virtual harddrive from fragmenting too much
127 find /var/cache/apt/archives/ -name '*.deb' -delete
128
129 # cleanup unwanted stuff
130 # video drivers (all but vesa)
131 apt-get purge -y $(apt-cache search --names-only --installed xserver-xorg-video | grep xserver-xorg-video | cut -d ' ' -f 1,1) xserver-xorg-video-vesa+
132 apt-get purge -y brasero
133
134 # and whatever is obsolete
135 apt-get autoremove --purge -y
136
137 # custom config
138 # use NeuroDebian website as default homepage
139 sed -i -e 's,http://www.debian.org,http://neuro.debian.net,g' /etc/chromium-browser/master_preferences
140
141 # reduce grub timeout to speed up boot of VM
142 sed -i -e 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/g' /etc/default/grub
143 update-grub
144
145 # finally configure geomirror for APT and disable deb-src lists
146 sed -i -e "s/10.0.0.1:9999/$(dpkg --print-architecture)-geomirror.debian.net/" \
147     -e "s/^deb-src/#deb-src/" /etc/apt/sources.list
148
149 etckeeper commit "Initial VM setup done"
150
151 # Create a link to automatically mounted Shared folder
152 # Created by the Welcome Wizard
153 #sudo -u brain ln -s /mnt/host /home/brain/