Merge remote-tracking branch 'origin/feature/jenkins-compatible-build-script' into...
[tails-test.git] / vagrant / provision / setup-tails-builder
blob733a4de8bd02d5ab74c9a1ec48f9a0ff9fba29ff
1 #!/bin/sh
3 set -e
5 # Do not use virtual machine proxy before apt-cacher-ng is installed
6 if [ "$http_proxy" = "http://$(hostname -f):3142" ] &&
7 ! [ -f /etc/apt-cacher-ng/acng.conf ]; then
8 LOCAL_HTTP_PROXY="$http_proxy"
9 http_proxy=''
12 # Uninstall custom Ikiwiki in case the build directory is still there
13 if [ -d /home/vagrant/ikiwiki ]; then
14 rm -f /usr/local/bin/ikiwiki*
15 rm -rf /usr/local/lib/perl/5.10.1/auto/IkiWiki
16 rm -rf /usr/local/share/perl/5.10.1/
17 rm -rf /home/vagrant/ikiwiki
20 # Add unstable repository for ikiwiki, and pin it low
21 echo 'deb http://cdn.debian.net/debian unstable main' > /etc/apt/sources.list.d/unstable.list
22 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/unstable <<EOF
23 Package: *
24 Pin: release a=unstable
25 Pin-Priority: 99
26 EOF
27 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/ikiwiki <<EOF
28 Package: ikiwiki
29 Pin: release a=unstable
30 Pin-Priority: 500
31 EOF
33 apt-get update
34 apt-get -y install apt-cacher-ng
36 # Install custom configuration for apt-cacher-ng and restart
37 install -o root -g root -m 644 /vagrant/provision/assets/acng.conf /etc/apt-cacher-ng/acng.conf
38 service apt-cacher-ng restart
40 # Restore local HTTP proxy if needed
41 if [ "$LOCAL_HTTP_PROXY" ]; then
42 http_proxy="$LOCAL_HTTP_PROXY"
45 # Upgrade if needed
46 apt-get -y dist-upgrade
48 # Those are needed to build Tails
49 apt-get -y install \
50 live-build \
51 eatmydata/squeeze-backports \
52 time whois \
53 dpkg-dev \
54 git \
55 aufs-tools \
56 ikiwiki
58 # Be sure to get all the modules we need for our Ikiwiki
59 apt-get -y --no-install-recommends install \
60 libyaml-perl libyaml-libyaml-perl po4a perlmagick libyaml-syck-perl \
61 libfile-chdir-perl liburi-perl libhtml-parser-perl wdg-html-validator \
62 libhtml-scrubber-perl libhtml-template-perl libtimedate-perl \
63 libxml-simple-perl libtext-multimarkdown-perl
65 # Add build script
66 install -o root -g root -m 755 /vagrant/provision/assets/build-tails /usr/local/bin
68 update_live_build_conf()
70 local var="$1"
71 local value="$2"
73 mkdir -p /etc/live
74 touch /etc/live/build.conf
75 sed -e "/^[[:space:]]*$var=/d" -i /etc/live/build.conf
76 echo "$var='$value'" >> /etc/live/build.conf
79 # Force APT repositories to a fixed mirror
80 update_live_build_conf LB_MIRROR_BINARY "http://ftp.us.debian.org/debian/"
81 update_live_build_conf LB_PARENT_MIRROR_BINARY "http://ftp.us.debian.org/debian/"