From 94caba577133f4f1a5694769297c1deb025ad2b1 Mon Sep 17 00:00:00 2001 From: Ryan Kuba Date: Mon, 26 Jun 2023 17:39:48 +0000 Subject: [PATCH] Resolve KASM-4515 "Feature/ firefox langpack install" --- src/alpine/install/firefox/install_firefox.sh | 22 +++++++++++-------- src/ubuntu/install/firefox/install_firefox.sh | 20 ++++++++++++++++- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/alpine/install/firefox/install_firefox.sh b/src/alpine/install/firefox/install_firefox.sh index e7664ff..1b33ba1 100644 --- a/src/alpine/install/firefox/install_firefox.sh +++ b/src/alpine/install/firefox/install_firefox.sh @@ -4,15 +4,19 @@ set -xe apk add --no-cache \ firefox -# Disabling default first run URL -cat >/usr/lib/firefox/browser/defaults/preferences/vendor.js <|)' '/href.*xpi/ {print $2}' | tr '\n' ' ') +EXTENSION_DIR=/usr/lib/firefox-addons/distribution/extensions/ +mkdir -p ${EXTENSION_DIR} +for LANG in ${LANGS}; do + LANGCODE=$(echo ${LANG} | sed 's/\.xpi//g') + echo "Downloading ${LANG} Language pack" + curl -o \ + ${EXTENSION_DIR}langpack-${LANGCODE}@firefox.mozilla.org.xpi -Ls \ + ${RELEASE_URL}${LANG} +done # Creating a default profile firefox -headless -CreateProfile "kasm $HOME/.mozilla/firefox/kasm" diff --git a/src/ubuntu/install/firefox/install_firefox.sh b/src/ubuntu/install/firefox/install_firefox.sh index 9f7b9e7..60bd17e 100644 --- a/src/ubuntu/install/firefox/install_firefox.sh +++ b/src/ubuntu/install/firefox/install_firefox.sh @@ -53,6 +53,21 @@ else apt-get install -y firefox p11-kit-modules fi +# Add Langpacks +FIREFOX_VERSION=$(curl -sI https://download.mozilla.org/?product=firefox-latest | awk -F '(releases/|/win32)' '/Location/ {print $2}') +RELEASE_URL="https://releases.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/win64/xpi/" +LANGS=$(curl -Ls ${RELEASE_URL} | awk -F '(xpi">|)' '/href.*xpi/ {print $2}' | tr '\n' ' ') +EXTENSION_DIR=/usr/lib/firefox-addons/distribution/extensions/ +mkdir -p ${EXTENSION_DIR} +for LANG in ${LANGS}; do + LANGCODE=$(echo ${LANG} | sed 's/\.xpi//g') + echo "Downloading ${LANG} Language pack" + curl -o \ + ${EXTENSION_DIR}langpack-${LANGCODE}@firefox.mozilla.org.xpi -Ls \ + ${RELEASE_URL}${LANG} +done + +# Cleanup and install flash if supported if [[ "${DISTRO}" == @(centos|oracle8|rockylinux9|rockylinux8|oracle9|almalinux9|almalinux8|fedora37) ]]; then if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|almalinux9|almalinux8|fedora37) ]]; then if [ -z ${SKIP_CLEAN+x} ]; then @@ -104,7 +119,9 @@ elif [ "${DISTRO}" == "opensuse" ]; then else preferences_file=/usr/lib/firefox/browser/defaults/preferences/firefox.js fi -# Disabling default first run URL + +# Disabling default first run URL for Debian based images +if [[ "${DISTRO}" != @(centos|oracle8|rockylinux9|rockylinux8|oracle9|almalinux9|almalinux8|opensuse|fedora37|fedora38) ]]; then cat >"$preferences_file" <