config 3.72 KB
Newer Older
amnesia's avatar
amnesia committed
1
#! /bin/sh
2
# automatically run by "lb config"
amnesia's avatar
amnesia committed
3

4 5
set -x

6 7
# we require building from git
if ! git rev-parse --is-inside-work-tree; then
Tails developers's avatar
Typos.  
Tails developers committed
8
    echo "${PWD} is not a Git tree. Exiting."
9 10 11
    exit 1
fi

12 13 14
. config/amnesia
if [ -e config/amnesia.local ] ; then
   . config/amnesia.local
amnesia's avatar
amnesia committed
15 16
fi

intrigeri's avatar
intrigeri committed
17 18
export LB_BOOTSTRAP_INCLUDE='eatmydata'

19
# init variables
20
RUN_LB_CONFIG="lb config noauto"
amnesia's avatar
amnesia committed
21

22
# init config/ with defaults for the target distribution
23
$RUN_LB_CONFIG --distribution jessie ${@}
amnesia's avatar
amnesia committed
24

25
# set up everything for time-based snapshots:
26
apt-snapshots-serials prepare-build
27

28 29
DEBIAN_MIRROR="$(apt-mirror debian)"
DEBIAN_SECURITY_MIRROR="$(apt-mirror debian-security)"
30

amnesia's avatar
amnesia committed
31
# set Amnesia's general options
32
$RUN_LB_CONFIG \
33
   --verbose \
34
   --apt-recommends false \
Tails developers's avatar
Tails developers committed
35
   --backports false \
36
   --binary-images iso \
37
   --binary-indices false \
38
   --checksums none \
amnesia's avatar
amnesia committed
39
   --bootappend-live "${AMNESIA_APPEND}" \
Cyril Brulebois's avatar
Cyril Brulebois committed
40
   --bootstrap debootstrap \
41
   --bootstrap-config tails-build-jessie \
42
   --archive-areas "main contrib non-free" \
43
   --includes none \
44
   --iso-application="The Amnesic Incognito Live System" \
45
   --iso-publisher="https://tails.boum.org/" \
amnesia's avatar
amnesia committed
46
   --iso-volume="TAILS ${AMNESIA_FULL_VERSION}" \
amnesia's avatar
amnesia committed
47
   --memtest none \
48 49 50 51 52
   --mirror-binary              "$DEBIAN_MIRROR" \
   --mirror-bootstrap           "$DEBIAN_MIRROR" \
   --mirror-chroot              "$DEBIAN_MIRROR" \
   --mirror-binary-security     "$DEBIAN_SECURITY_MIRROR" \
   --mirror-chroot-security     "$DEBIAN_SECURITY_MIRROR" \
53
   --packages-lists="standard" \
54
   --tasks="standard" \
55
   --linux-packages="linux-image-3.16.0-4" \
56
   --syslinux-menu vesamenu \
T(A)ILS developers's avatar
T(A)ILS developers committed
57
   --syslinux-splash data/splash.png \
amnesia's avatar
amnesia committed
58
   --syslinux-timeout 4 \
59
   --initramfs=live-boot \
amnesia's avatar
amnesia committed
60 61
   ${@}

62
# build i386 images on amd64 as well, include a bunch of kernels
amnesia's avatar
amnesia committed
63 64
hw_arch="`dpkg --print-architecture`"
if [ "$hw_arch" = i386 -o "$hw_arch" = amd64 ]; then
65
   $RUN_LB_CONFIG \
amnesia's avatar
amnesia committed
66
      --architecture i386 \
67
      --linux-flavours "586 amd64" \
amnesia's avatar
amnesia committed
68
      ${@}
69 70
# build powerpc images on powerpc64 as well, include only powerpc kernel
elif [ "$hw_arch" = powerpc -o "$hw_arch" = powerpc64 ]; then
71
   $RUN_LB_CONFIG \
72 73 74
      --architecture powerpc \
      --linux-flavours powerpc \
      ${@}
amnesia's avatar
amnesia committed
75 76
fi

77 78 79 80 81 82 83 84
install -d config/chroot_local-includes/etc/amnesia/

# environment
TAILS_WIKI_SUPPORTED_LANGUAGES="$(ikiwiki-supported-languages ikiwiki.setup)"
[ -n "$TAILS_WIKI_SUPPORTED_LANGUAGES" ] || exit 16
echo "TAILS_WIKI_SUPPORTED_LANGUAGES='${TAILS_WIKI_SUPPORTED_LANGUAGES}'" \
   >> config/chroot_local-includes/etc/amnesia/environment

amnesia's avatar
amnesia committed
85
# version
86
echo "${AMNESIA_FULL_VERSION}" > config/chroot_local-includes/etc/amnesia/version
amnesia's avatar
amnesia committed
87
if git rev-list HEAD 2>&1 >/dev/null; then
88 89
   git rev-list HEAD | head -n 1 >> config/chroot_local-includes/etc/amnesia/version
fi
90 91
echo "live-build: `dpkg-query -W -f='${Version}\n' live-build`" \
   >> config/chroot_local-includes/etc/amnesia/version
92 93 94 95 96
# os-release
cat >> config/chroot_local-includes/etc/os-release <<EOF
TAILS_PRODUCT_NAME="Tails"
TAILS_VERSION_ID="$AMNESIA_VERSION"
EOF
97 98

# changelog
99
cp debian/changelog config/chroot_local-includes/usr/share/doc/amnesia/Changelog
100

101 102 103 104 105 106
# create readahead-list from squashfs.sort
if [ -e config/binary_rootfs/squashfs.sort ]; then
    mkdir -p config/chroot_local-includes/usr/share/amnesia
    sort -k2 -n -r config/binary_rootfs/squashfs.sort |
        cut -d' ' -f1 > config/chroot_local-includes/usr/share/amnesia/readahead-list
fi
107 108 109

# custom APT sources
tails-custom-apt-sources > config/chroot_sources/tails.chroot
Cyril Brulebois's avatar
Cyril Brulebois committed
110 111

# custom debootstrap script, setting some APT magic to log downloads:
112 113 114 115 116 117
patch \
    --follow-symlinks \
    --output=/usr/share/debootstrap/scripts/tails-build-jessie \
    /usr/share/debootstrap/scripts/jessie \
    data/debootstrap/scripts/jessie.patch
sed -i "s,%%topdir%%,$(pwd)," /usr/share/debootstrap/scripts/tails-build-jessie