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