]> git.donarmstrong.com Git - neurodebian.git/blob - vm/d-i/wheezy/initial_setup
Add 'bc' as a default package for the VM
[neurodebian.git] / vm / d-i / wheezy / 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/wheezy.us-nh
51
52 # Development versions (TODO: comment out upon finishing)
53 #cat /etc/apt/sources.list.d/neuro.debian.net.list | sed -e 's,/debian ,/debian-devel ,g' \
54 #       >| /etc/apt/sources.list.d/neuro.debian.net-devel.list
55
56 ## No backports yet
57 ## echo "deb http://backports.debian.org/debian-backports wheezy-backports main contrib non-free" > /etc/apt/sources.list.d/backports.debian.org.list
58 cat << EOT > /etc/apt/preferences.d/backports.debian.org.pref
59 Package: *
60 Pin: release a=wheezy-backports
61 Pin-Priority: 200
62 EOT
63
64 apt-get update -y
65 # Backports' Release files signed with both ftpmaster and old backports keys
66 # That causes APT to spit out a warning, but to not confuse users, lets simply
67 # obtain that key if possible
68 gpg --keyserver hkp://subkeys.pgp.net --recv-keys 16BA136C && \
69         gpg --export 16BA136C | apt-key add - || :
70
71 apt-get install -y --allow-unauthenticated neurodebian-keyring
72 apt-get update -y
73
74 # to cheat the VM check
75 touch /dev/vboxguest
76
77 # Assure that corresponding linux headers are installed since otherwise they
78 # might not be.  There is also a dichotomy between target 686 and installer
79 # using 486 build of the kernel.  It requires manual build/installation
80 # of guest additions for 686 at this point. Hence all the ugly logic below
81 cunamer=`uname -r`
82 cdarch=${cunamer##*-}
83 # We carry 686 only
84 [ $cdarch = '486' ] && darch='686-pae' || darch=$cdarch
85 apt-get install -y linux-headers-$cdarch
86
87 ## # Forcefully install guest additions from backports so we are
88 ## # compatible with VirtualBox 4.x series
89 ## apt-get install -y -t wheezy-backports virtualbox-ose-guest-dkms \
90 ##      virtualbox-ose-guest-utils  virtualbox-ose-guest-x11 \
91 ##      >| /var/log/initial_setup-dkms.log 2>&1
92
93 # to get all the rest stuff in recommends
94 apt-get install -y dkms neurodebian-guest-additions
95
96 if [ "$darch" != "$cdarch" ] ; then
97     # Because DKMS builds for currently running kernel, which during
98     # installation might be a more generic 486, lets force building for 686
99         # and also install necessary headers (will be purged later on anyways)
100         apt-get install -y linux-headers-$darch
101
102         unamer=${cunamer//$cdarch/$darch}
103         # First collect information about installed vb additions
104         vbg=( `dkms status | grep virtualbox | head -n 1 | tr ',' ' '` )
105         echo "I: forcing build and install of guest additions for 686"
106         dkms build -m ${vbg[0]} -v ${vbg[1]} -a i686 -k $unamer \
107                 >| /var/log/initial_setup-dkms-686-build.log 2>&1
108         dkms install -m ${vbg[0]} -v ${vbg[1]} -a i686 -k $unamer \
109                 >| /var/log/initial_setup-dkms-686-install.log 2>&1
110 fi
111
112 # Prune DKMS's build -- should be no need to carry it around
113 find /var/lib/dkms -iname build | xargs -r rm -rf
114
115 # Add brain use into vboxsf group so he gets access to shared folders
116 # by default
117 adduser brain vboxsf
118
119 # assure at the end that we got right modules build in the right location
120 find /lib/modules/*$darch -iname vboxsf.ko | grep -q .
121
122 # That was for GNOME
123 # apt-get install --no-install-recommends -y \
124 #  gnome-core mc evince bash-completion ntpdate file-roller gnome-utils \
125 #  gnome-themes gnome-disk-utility network-manager-gnome eog vim reportbug \
126 #  software-center gdebi gedit-plugins gnome-media synaptic menu less libxp6
127
128 apt-get install --no-install-recommends -y \
129  mc evince bash-completion ntpdate file-roller \
130  eog vim reportbug \
131  software-center synaptic menu less libxp6 \
132  task-xfce-desktop lightdm zenity \
133  chromium-browser \
134  sudo neurodebian-desktop update-notifier \
135  bc
136
137 # Assure having xfce4 terminal and it being default one and other handy
138 # XFCE4 components
139 apt-get install -y xfce4-terminal thunar-archive-plugin
140 apt-get install --no-install-recommends -y gedit yelp
141
142 # Do not even try to deal with alternatives -- it will be the one and would puke
143 # update-alternatives --set x-terminal-emulator /usr/bin/xfce4-terminal
144
145 # XXX last ones are actually pulled it by neurodebian-guest-additions whenever we
146 # resolve their destiny ;-)   although it might be pooling too much, eg exim4
147
148 # Clean-up installed development files which got pulled in for
149 # VM guest additions (to build kernel modules via DKMS)
150 apt-get purge -y libc6-dev
151 dpkg -l | awk '/^ii.*[ \t]linux-headers/{print $2;}' | xargs -r apt-get purge -y
152
153 # Gnome optional pulled by gnome-core:
154 apt-get purge -y gnome-core evolution-common evolution libevolution
155
156 # And utter cleanup
157 apt-get -y autoremove
158
159 # intermediate cleanup to prevent virtual harddrive from fragmenting too much
160 find /var/cache/apt/archives/ -name '*.deb' -delete
161
162 # cleanup unwanted stuff
163 # video drivers (all but vesa)
164 apt-get purge -y --force-yes $(apt-cache search --names-only --installed xserver-xorg-video | grep xserver-xorg-video | cut -d ' ' -f 1,1) xserver-xorg-video-vesa+
165 apt-get purge -y brasero freepats
166
167 # Seems to be not used by any installed piece
168 apt-get purge -y libwebkitgtk-1.0-0
169
170 # and whatever is obsolete
171 apt-get autoremove --purge -y
172
173 # custom config
174 # use NeuroDebian website as default homepage
175 sed -i -e 's,http://www.debian.org,http://neuro.debian.net,g' /etc/chromium*/master_preferences
176
177 # Place default XFCE4 panel config, otherwise a dialog appears
178 # Thanks go to cavalier@freenode IRC for the hint
179 xfdir=/home/brain/.config/xfce4/xfconf/xfce-perchannel-xml
180 mkdir -p $xfdir
181 cp /etc/xdg/xfce4/panel/default.xml $xfdir/xfce4-panel.xml
182 chown brain.brain -R /home/brain/.config
183
184 # reduce grub timeout to speed up boot of VM
185 sed -i -e 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/g' /etc/default/grub
186 update-grub
187
188 # finally configure geomirror for APT and disable deb-src lists
189 cp /etc/apt/sources.list /etc/apt/sources.list.orig
190 sed -i -e "s,\(deb\(\|-src\) http://\)[^/]*/debian,\1http.debian.net/debian,g" \
191     -e "s/^deb-src/#deb-src/" /etc/apt/sources.list
192
193 etckeeper commit "Initial VM setup done"
194
195 # Create a link to automatically mounted Shared folder
196 # Created by the Welcome Wizard
197 #sudo -u brain ln -s /mnt/host /home/brain/