Commit b08dbb3f authored by Tails developers's avatar Tails developers
Browse files

Refactor code for setting Torbutton's forced browser name.

parent 958fe087
......@@ -104,3 +104,13 @@ run_chroot_browser () {
-profile /home/'"${chroot_user}"'/.tor-browser/profile.default'
sudo -u ${local_user} xhost -SI:localuser:${chroot_user} 2>/dev/null
# TorButton forces the Browser name to Tor Browser unless we alter its
# branding files a bit.
set_chroot_torbutton_browser_name () {
local chroot="${1}"
local name="${2}"
local torbutton_dir="${chroot}"/usr/share/xul-ext/torbutton
find "${torbutton_dir}" -name 'brand.dtd' -print0 | \
xargs -0 -r sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${name}\">/"
......@@ -86,17 +86,13 @@ configure_chroot () {
mkdir -p "${BROWSER_EXT}"
ln -s "${NOSCRIPT}" "${BROWSER_EXT}"
# TorButton forces the Browser name to Tor Browser. This hack is to undo that and set it to I2P Browser
# to try to prevent user confusion.
TMP=$(mktemp -d)
cp -a /usr/share/xul-ext/torbutton/ $TMP
for LANGPACK in $(ls ${TBB_PROFILE}/extensions/langpack-*.xpi); do
ln -s "${LANGPACK}" "${BROWSER_EXT}"
find $TMP/torbutton -name 'brand.dtd' -print0 | \
xargs -0 -r sed -i "s/<"'!'"ENTITY\s\+brand\(Full\|Short\)Name.*$/<"'!'"ENTITY brand\1Name \"${NAME}\">/"
cd $TMP/torbutton && 7z a -tzip "${BROWSER_EXT}/" .
rm -r $TMP
set_chroot_torbutton_browser_name "${CHROOT}" "${NAME}"
mkdir -p "${BROWSER_PREF_DIR}"
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