config 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #! /bin/sh
  2. # automatically run by "lb config"
  3. set -x
  4. # we require building from git
  5. if ! git rev-parse --is-inside-work-tree; then
  6. echo "${PWD} is not a Git tree. Exiting."
  7. exit 1
  8. fi
  9. . config/amnesia
  10. if [ -e config/amnesia.local ] ; then
  11. . config/amnesia.local
  12. fi
  13. export LB_BOOTSTRAP_INCLUDE='eatmydata'
  14. # sanity checks
  15. if grep -qs -E '^Pin:\s+release\s+.*a=' config/chroot_apt/preferences ; then
  16. echo "Found unsupported a= syntax in config/chroot_apt/preferences,"
  17. echo "use n= instead. Exiting."
  18. exit 1
  19. fi
  20. if grep -qs -E '^Pin:\s+release\s+.*o=Debian Backports' \
  21. config/chroot_apt/preferences ; then
  22. echo "Found unsupported 'o=Debian Backports' syntax,"
  23. echo "in config/chroot_apt/preferences. Use o=Debian instead. Exiting."
  24. exit 1
  25. fi
  26. # init variables
  27. RUN_LB_CONFIG="lb config noauto"
  28. # init config/ with defaults for the target distribution
  29. $RUN_LB_CONFIG --distribution jessie ${@}
  30. # set up everything for time-based snapshots:
  31. apt-snapshots-serials prepare-build
  32. DEBIAN_MIRROR="$(apt-mirror debian)"
  33. DEBIAN_SECURITY_MIRROR="$(apt-mirror debian-security)"
  34. TORPROJECT_MIRROR="$(apt-mirror torproject)"
  35. [ -n "$DEBIAN_MIRROR" ] || exit 1
  36. [ -n "$DEBIAN_SECURITY_MIRROR" ] || exit 1
  37. [ -n "$TORPROJECT_MIRROR" ] || exit 1
  38. perl -pi \
  39. -E \
  40. "s|^(deb(?:-src)?\s+)https?://ftp[.]us[.]debian[.]org/debian/?(\s+)|\$1$DEBIAN_MIRROR\$2| ; \
  41. s|^(deb(?:-src)?\s+)https?://deb[.]torproject[.]org/torproject[.]org/?(\s+)|\$1$TORPROJECT_MIRROR\$2|" \
  42. config/chroot_sources/*.chroot \
  43. || exit 1
  44. # set Amnesia's general options
  45. $RUN_LB_CONFIG \
  46. --verbose \
  47. --apt-recommends false \
  48. --backports false \
  49. --binary-images iso \
  50. --binary-indices false \
  51. --checksums none \
  52. --bootappend-live "${AMNESIA_APPEND}" \
  53. --bootstrap debootstrap \
  54. --bootstrap-config tails-build-jessie \
  55. --archive-areas "main contrib non-free" \
  56. --includes none \
  57. --iso-application="The Amnesic Incognito Live System" \
  58. --iso-publisher="https://tails.boum.org/" \
  59. --iso-volume="TAILS ${AMNESIA_FULL_VERSION}" \
  60. --memtest none \
  61. --mirror-binary "$DEBIAN_MIRROR" \
  62. --mirror-bootstrap "$DEBIAN_MIRROR" \
  63. --mirror-chroot "$DEBIAN_MIRROR" \
  64. --mirror-binary-security "$DEBIAN_SECURITY_MIRROR" \
  65. --mirror-chroot-security "$DEBIAN_SECURITY_MIRROR" \
  66. --packages-lists="standard" \
  67. --tasks="standard" \
  68. --linux-packages="linux-image-${KERNEL_VERSION}" \
  69. --syslinux-menu vesamenu \
  70. --syslinux-splash data/splash.png \
  71. --syslinux-timeout 4 \
  72. --initramfs=live-boot \
  73. ${@}
  74. # build i386 images on amd64 as well, include a bunch of kernels
  75. hw_arch="`dpkg --print-architecture`"
  76. if [ "$hw_arch" = i386 -o "$hw_arch" = amd64 ]; then
  77. $RUN_LB_CONFIG \
  78. --architecture i386 \
  79. --linux-flavours "686-unsigned" \
  80. ${@}
  81. # build powerpc images on powerpc64 as well, include only powerpc kernel
  82. elif [ "$hw_arch" = powerpc -o "$hw_arch" = powerpc64 ]; then
  83. $RUN_LB_CONFIG \
  84. --architecture powerpc \
  85. --linux-flavours powerpc \
  86. ${@}
  87. fi
  88. install -d config/chroot_local-includes/etc/amnesia/
  89. # environment
  90. TAILS_WIKI_SUPPORTED_LANGUAGES="$(ikiwiki-supported-languages ikiwiki.setup)"
  91. [ -n "$TAILS_WIKI_SUPPORTED_LANGUAGES" ] || exit 16
  92. echo "TAILS_WIKI_SUPPORTED_LANGUAGES='${TAILS_WIKI_SUPPORTED_LANGUAGES}'" \
  93. >> config/chroot_local-includes/etc/amnesia/environment
  94. # version
  95. echo "${AMNESIA_FULL_VERSION}" > config/chroot_local-includes/etc/amnesia/version
  96. if git rev-list HEAD 2>&1 >/dev/null; then
  97. git rev-list HEAD | head -n 1 >> config/chroot_local-includes/etc/amnesia/version
  98. fi
  99. echo "live-build: `dpkg-query -W -f='${Version}\n' live-build`" \
  100. >> config/chroot_local-includes/etc/amnesia/version
  101. # os-release
  102. cat >> config/chroot_local-includes/etc/os-release <<EOF
  103. TAILS_PRODUCT_NAME="Tails"
  104. TAILS_VERSION_ID="$AMNESIA_VERSION"
  105. EOF
  106. # changelog
  107. cp debian/changelog config/chroot_local-includes/usr/share/doc/amnesia/Changelog
  108. # create readahead-list from squashfs.sort
  109. if [ -e config/binary_rootfs/squashfs.sort ]; then
  110. mkdir -p config/chroot_local-includes/usr/share/amnesia
  111. sort -k2 -n -r config/binary_rootfs/squashfs.sort |
  112. cut -d' ' -f1 > config/chroot_local-includes/usr/share/amnesia/readahead-list
  113. fi
  114. # custom APT sources
  115. tails-custom-apt-sources > config/chroot_sources/tails.chroot
  116. # tails-transform-mirror-url and its dependencies
  117. install -m 0755 \
  118. submodules/mirror-pool-dispatcher/bin/tails-transform-mirror-url \
  119. config/chroot_local-includes/usr/local/bin/
  120. install -m 0755 -d config/chroot_local-includes/usr/local/lib/nodejs
  121. install -m 0755 \
  122. submodules/mirror-pool-dispatcher/lib/js/mirror-dispatcher.js \
  123. config/chroot_local-includes/usr/local/lib/nodejs/
  124. # aufs4-standalone
  125. rm -rf config/chroot_local-includes/usr/src/aufs4-standalone
  126. cp -a submodules/aufs4-standalone config/chroot_local-includes/usr/src/
  127. # custom debootstrap script, setting some APT magic to log downloads:
  128. patch \
  129. --follow-symlinks \
  130. --output=/usr/share/debootstrap/scripts/tails-build-jessie \
  131. /usr/share/debootstrap/scripts/jessie \
  132. data/debootstrap/scripts/jessie.patch
  133. sed -i "s,%%topdir%%,$(pwd)," /usr/share/debootstrap/scripts/tails-build-jessie