Commit 122e1417 authored by intrigeri's avatar intrigeri
Browse files

Build system: instead of downloading every localized Tor Browser, use the...

Build system: instead of downloading every localized Tor Browser, use the tarball with all langpacks (refs: #17400)
parent 9734b292
...@@ -17,9 +17,9 @@ echo "Install the Tor Browser" ...@@ -17,9 +17,9 @@ echo "Install the Tor Browser"
. /usr/local/lib/tails-shell-library/build.sh . /usr/local/lib/tails-shell-library/build.sh
download_and_verify_files() { download_and_verify_files() {
local base_url bundles destination apt_proxy local base_url target_files destination apt_proxy
base_url="${1}" base_url="${1}"
bundles="${2}" target_files="${2}"
destination="${3}" destination="${3}"
# Use the builder's caching APT proxy, if any # Use the builder's caching APT proxy, if any
...@@ -31,7 +31,7 @@ download_and_verify_files() { ...@@ -31,7 +31,7 @@ download_and_verify_files() {
export https_proxy="${apt_proxy}" export https_proxy="${apt_proxy}"
fi fi
echo "${bundles}" | while read expected_sha256 tarball; do echo "${target_files}" | while read expected_sha256 tarball; do
( (
cd "${destination}" cd "${destination}"
echo "Fetching ${base_url}/${tarball} ..." echo "Fetching ${base_url}/${tarball} ..."
...@@ -277,23 +277,21 @@ strip_nondeterminism () { ...@@ -277,23 +277,21 @@ strip_nondeterminism () {
done done
} }
install_langpacks_from_bundles() { install_langpacks() {
local bundles_dir destination local langpacks_tarball destination tmp
bundles_dir="${1}" langpacks_tarball="${1}"
destination="${2}" destination="${2}"
for tarball in "${bundles_dir}"/tor-browser-*.tar.xz; do tmp="$(mktemp -d)"
locale="$(echo "${tarball}" | sed "s@^.*/tor-browser-.*_\(.*\)\.tar\.xz@\1@")"
if [ "${locale}" = en-US ]; then tar --directory="${tmp}" -xf "${langpacks_tarball}"
continue for xpi in "${tmp}"/*.xpi; do
fi locale="$(basename "${xpi}" .xpi)"
xpi="tor-browser_${locale}/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-${locale}@firefox.mozilla.org.xpi" dest_basename="langpack-${locale}@firefox.mozilla.org.xpi"
( [ "${locale}" = en-US ] || mv "${xpi}" "${destination}/${dest_basename}"
cd "${bundles_dir}"
tar -xf "${tarball}" "${xpi}"
mv "${xpi}" "${destination}"
)
done done
rm -r "${tmp}"
} }
get_firefox_version() { get_firefox_version() {
...@@ -335,8 +333,7 @@ TBB_TIMESTAMP="$(date --date='2000-01-01 00:00:00' +%s)" ...@@ -335,8 +333,7 @@ TBB_TIMESTAMP="$(date --date='2000-01-01 00:00:00' +%s)"
TBB_SHA256SUMS_FILE=/usr/share/tails/tbb-sha256sums.txt TBB_SHA256SUMS_FILE=/usr/share/tails/tbb-sha256sums.txt
TBB_TARBALLS="$(grep "\<tor-browser-linux64-.*\.tar.xz$" "${TBB_SHA256SUMS_FILE}")" TBB_TARBALLS="$(grep "\<tor-browser-linux64-.*\.tar.xz$" "${TBB_SHA256SUMS_FILE}")"
# We'll use the en-US bundle as our basis; only langpacks will be # We'll use the en-US bundle as our basis
# installed from the other bundles.
MAIN_TARBALL="$(echo "${TBB_TARBALLS}" | grep -o "tor-browser-linux64-.*_en-US\.tar\.xz" || :)" MAIN_TARBALL="$(echo "${TBB_TARBALLS}" | grep -o "tor-browser-linux64-.*_en-US\.tar\.xz" || :)"
NIGHTLY_BUILD= NIGHTLY_BUILD=
if [ -z "${MAIN_TARBALL}" ] && [ "$(echo $TBB_TARBALLS | awk '{ print $2 }')" = 'tor-browser-linux64-tbb-nightly_ALL.tar.xz' ]; then if [ -z "${MAIN_TARBALL}" ] && [ "$(echo $TBB_TARBALLS | awk '{ print $2 }')" = 'tor-browser-linux64-tbb-nightly_ALL.tar.xz' ]; then
...@@ -363,7 +360,8 @@ install_tor_launcher "${TBB_INSTALL}" "${TOR_LAUNCHER_INSTALL}" ...@@ -363,7 +360,8 @@ install_tor_launcher "${TBB_INSTALL}" "${TOR_LAUNCHER_INSTALL}"
mkdir -p "${TBB_EXT}" mkdir -p "${TBB_EXT}"
if [ "${NIGHTLY_BUILD}" != yes ]; then if [ "${NIGHTLY_BUILD}" != yes ]; then
install_langpacks_from_bundles "${TMP}" "${TBB_EXT}" LANGPACKS_TARBALL="$(echo "${TBB_TARBALLS}" | grep -o "langpacks-tor-browser-linux64-.*\.tar\.xz")"
install_langpacks "${TMP}/${LANGPACKS_TARBALL}" "${TBB_EXT}"
fi fi
rm -r "${TMP}" rm -r "${TMP}"
......
...@@ -61,13 +61,18 @@ with GnuPG: ...@@ -61,13 +61,18 @@ with GnuPG:
wget ${TBB_DIST_URL:?}/sha256sums-unsigned-build.txt{.asc,} && \ wget ${TBB_DIST_URL:?}/sha256sums-unsigned-build.txt{.asc,} && \
gpg --verify sha256sums-unsigned-build.txt{.asc,} gpg --verify sha256sums-unsigned-build.txt{.asc,}
Filter the tarballs we want and make them available at build time, Build the list of tarballs we want and their hashes,
so this information is available at build time,
when the tarballs are fetched: when the tarballs are fetched:
grep --color=never -E \ (
"\s(langpacks-)?tor-browser-linux64-[0-9].*\.tar.xz$" \ grep --color=never -E \
sha256sums-unsigned-build.txt \ "\stor-browser-linux64-[0-9].*_en-US\.tar\.xz$" \
> config/chroot_local-includes/usr/share/tails/tbb-sha256sums.txt sha256sums-unsigned-build.txt \
&& grep --color=never -E \
"\slangpacks-tor-browser-linux64-.*\.tar\.xz$" \
sha256sums-unsigned-build.txt \
) > config/chroot_local-includes/usr/share/tails/tbb-sha256sums.txt
Then update the URL to the one chosen above: Then update the URL to the one chosen above:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment