Merge remote-tracking branch 'origin/feature/7461-persistence.conf-in-whisperback...
[tails/lblissett.git] / vagrant / provision / setup-tails-builder
blobd30665dcf62c39e4eba43f0167b56c882a014e73
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 apt-get update
53 apt-get -y install apt-cacher-ng
55 # Install custom configuration for apt-cacher-ng and restart
56 install -o root -g root -m 644 /vagrant/provision/assets/acng.conf /etc/apt-cacher-ng/acng.conf
57 service apt-cacher-ng restart
59 # Restore local HTTP proxy if needed
60 if [ "$LOCAL_HTTP_PROXY" ]; then
61 http_proxy="$LOCAL_HTTP_PROXY"
64 # Upgrade if needed
65 apt-get -y dist-upgrade
67 # Those are needed to build Tails
68 apt-get -y install \
69 live-build \
70 eatmydata \
71 time whois \
72 dpkg-dev \
73 git \
74 aufs-tools \
75 ikiwiki \
76 intltool
78 # Be sure to get all the modules we need for our Ikiwiki
79 apt-get -y --no-install-recommends install \
80 libyaml-perl libyaml-libyaml-perl po4a perlmagick libyaml-syck-perl \
81 libfile-chdir-perl liburi-perl libhtml-parser-perl wdg-html-validator \
82 libhtml-scrubber-perl libhtml-template-perl libtimedate-perl \
83 libxml-simple-perl libtext-multimarkdown-perl
85 # Add build script
86 install -o root -g root -m 755 /vagrant/provision/assets/build-tails /usr/local/bin
88 update_live_build_conf()
90 local var="$1"
91 local value="$2"
93 mkdir -p /etc/live
94 touch /etc/live/build.conf
95 sed -e "/^[[:space:]]*$var=/d" -i /etc/live/build.conf
96 echo "$var='$value'" >> /etc/live/build.conf
99 # Force APT repositories to a fixed mirror
100 update_live_build_conf LB_MIRROR_BINARY "http://ftp.us.debian.org/debian/"
101 update_live_build_conf LB_PARENT_MIRROR_BINARY "http://ftp.us.debian.org/debian/"