Commit b47dc236 authored by Tails developers's avatar Tails developers

Optimize the startup of the chroot browsers.

Extracting and then compressing the whole langpack/omni.ja isn't
necessary and takes a lot of time. Tests show a 50% reduction in
startup time.
parent 3e80d570
......@@ -113,7 +113,6 @@ set_chroot_browser_name () {
NAME="${1}"
LOCALE="${2}"
EXT_DIR=${CHROOT}/"${TBB_EXT}"
BRANDING=branding/brand.dtd
if [ "${LOCALE}" != en-US ]; then
PACK="${EXT_DIR}/langpack-${LOCALE}@firefox.mozilla.org.xpi"
TOP=browser/chrome
......@@ -124,12 +123,12 @@ set_chroot_browser_name () {
REST=en-US/locale
fi
TMP=$(mktemp -d)
BRANDING="${TOP}/${REST}/branding/brand.dtd"
# Non-zero exit code due to non-standard ZIP archive.
# The following steps will fail soon if the extraction failed anyway.
7z x -o"${TMP}" "${PACK}" || true
sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${NAME}\">/" "${TMP}/${TOP}/${REST}/${BRANDING}"
rm "${PACK}"
(cd $TMP ; 7z a -tzip "${PACK}" .)
7z x -o"${TMP}" "${PACK}" "${BRANDING}" || true
sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${NAME}\">/" "${TMP}/${BRANDING}"
(cd $TMP ; 7z u -tzip "${PACK}" .)
chmod a+r "${PACK}"
rm -Rf "${TMP}"
}
......
......@@ -113,7 +113,6 @@ set_chroot_browser_name () {
NAME="${1}"
LOCALE="${2}"
EXT_DIR=${CHROOT}/"${TBB_EXT}"
BRANDING=branding/brand.dtd
if [ "${LOCALE}" != en-US ]; then
PACK="${EXT_DIR}/langpack-${LOCALE}@firefox.mozilla.org.xpi"
TOP=browser/chrome
......@@ -124,12 +123,12 @@ set_chroot_browser_name () {
REST=en-US/locale
fi
TMP=$(mktemp -d)
BRANDING="${TOP}/${REST}/branding/brand.dtd"
# Non-zero exit code due to non-standard ZIP archive.
# The following steps will fail soon if the extraction failed anyway.
7z x -o"${TMP}" "${PACK}" || true
sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${NAME}\">/" "${TMP}/${TOP}/${REST}/${BRANDING}"
rm "${PACK}"
(cd $TMP ; 7z a -tzip "${PACK}" .)
7z x -o"${TMP}" "${PACK}" "${BRANDING}" || true
sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${NAME}\">/" "${TMP}/${BRANDING}"
(cd $TMP ; 7z u -tzip "${PACK}" .)
chmod a+r "${PACK}"
rm -Rf "${TMP}"
}
......
Markdown is supported
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