Merge remote-tracking branch 'flapflap/de-network_configuration'
[tails-test.git] / vagrant / provision / setup-tails-builder
blob528925fcde344e756b3c51d613a3e68bd0131161
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 rm -f /etc/apt/preferences.d/* /etc/apt/sources.list.d/*
22 # Add our builder-wheezy repository for live-build, and pin it low
23 echo 'deb http://deb.tails.boum.org/ builder-wheezy main' > /etc/apt/sources.list.d/tails.list
24 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/tails <<EOF
25 Package: *
26 Pin: origin deb.tails.boum.org
27 Pin-Priority: 99
28 EOF
29 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/live-build <<EOF
30 Package: live-build
31 Pin: origin deb.tails.boum.org
32 Pin-Priority: 500
33 EOF
35 # We don't want to use apt-cacher-ng for gpg
36 http_proxy="" gpg --keyserver hkps.pool.sks-keyservers.net --recv-key C7988EA7A358D82E
37 gpg --export C7988EA7A358D82E | sudo apt-key add -
39 # Add unstable repository for ikiwiki, and pin it low
40 echo 'deb http://ftp.us.debian.org/debian unstable main' > /etc/apt/sources.list.d/unstable.list
41 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/unstable <<EOF
42 Package: *
43 Pin: release a=unstable
44 Pin-Priority: 99
45 EOF
46 sed -e 's/^[[:blank:]]*//' > /etc/apt/preferences.d/ikiwiki <<EOF
47 Package: ikiwiki
48 Pin: release a=unstable
49 Pin-Priority: 500
50 EOF
52 # Add wheezy-backports for apt-cacher-ng. The version in wheezy has problems
53 # with redirects to https, which we need when fetching the TBB tarballs
54 echo 'deb http://ftp.us.debian.org/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports.list
56 apt-get update
57 apt-get -o Dpkg::Options::="--force-confold" -y -t wheezy-backports install apt-cacher-ng
59 # Install custom configuration for apt-cacher-ng and restart
60 install -o root -g root -m 644 /vagrant/provision/assets/acng.conf /etc/apt-cacher-ng/acng.conf
61 service apt-cacher-ng restart
63 # Restore local HTTP proxy if needed
64 if [ "$LOCAL_HTTP_PROXY" ]; then
65 http_proxy="$LOCAL_HTTP_PROXY"
68 # Upgrade if needed
69 apt-get -y dist-upgrade
71 # Those are needed to build Tails
72 apt-get -y install \
73 live-build \
74 eatmydata \
75 time whois \
76 dpkg-dev \
77 git \
78 aufs-tools \
79 ikiwiki \
80 intltool \
81 gettext/wheezy-backports
83 # Be sure to get all the modules we need for our Ikiwiki
84 apt-get -y --no-install-recommends install \
85 libyaml-perl libyaml-libyaml-perl po4a perlmagick libyaml-syck-perl \
86 libfile-chdir-perl liburi-perl libhtml-parser-perl wdg-html-validator \
87 libhtml-scrubber-perl libhtml-template-perl libtimedate-perl \
88 libxml-simple-perl libtext-multimarkdown-perl
90 # Add build script
91 install -o root -g root -m 755 /vagrant/provision/assets/build-tails /usr/local/bin
93 update_live_build_conf()
95 local var="$1"
96 local value="$2"
98 mkdir -p /etc/live
99 touch /etc/live/build.conf
100 sed -e "/^[[:space:]]*$var=/d" -i /etc/live/build.conf
101 echo "$var='$value'" >> /etc/live/build.conf
104 # Force APT repositories to a fixed mirror
105 update_live_build_conf LB_MIRROR_BINARY "http://ftp.us.debian.org/debian/"
106 update_live_build_conf LB_PARENT_MIRROR_BINARY "http://ftp.us.debian.org/debian/"