-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from soup-bowl/soup-bowl/gitpod-improvements
Improved Firefox testing via Gitpod
- Loading branch information
Showing
3 changed files
with
85 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,89 @@ | ||
#! /bin/bash | ||
|
||
sudo apt-get remove firefox | ||
|
||
# Prioritise Deb Firefox over Snap. | ||
echo ' | ||
Package: * | ||
Pin: release o=LP-PPA-mozillateam | ||
Pin-Priority: 1001 | ||
' | sudo tee /etc/apt/preferences.d/mozilla-firefox | ||
|
||
sudo add-apt-repository ppa:mozillateam/ppa -y | ||
sudo apt-get update | ||
sudo apt-get install -y firefox firefox-esr | ||
sudo sed -i 's/Name=Firefox Web Browser/Name=Firefox Web Browser (ESR)/' /usr/share/applications/firefox-esr.desktop | ||
|
||
sudo wget -O /opt/firefox-nightly.tar.bz2 "https://download.mozilla.org/?product=firefox-nightly-latest&os=linux64&lang=en-US" | ||
sudo tar -xjf /opt/firefox-nightly.tar.bz2 -C /opt | ||
sudo mv /opt/firefox /opt/firefox-nightly | ||
sudo ln -sf /opt/firefox-nightly/firefox /usr/local/bin/firefox-nightly | ||
|
||
sudo wget -O /opt/firefox-developer.tar.bz2 "https://download.mozilla.org/?product=firefox-devedition-latest&os=linux64&lang=en-US" | ||
sudo tar -xjf /opt/firefox-developer.tar.bz2 -C /opt | ||
sudo mv /opt/firefox /opt/firefox-developer | ||
sudo ln -sf /opt/firefox-developer/firefox /usr/local/bin/firefox-developer | ||
|
||
timeout 5 firefox | ||
timeout 5 firefox-esr | ||
timeout 5 firefox-nightly | ||
timeout 5 firefox-developer | ||
|
||
MM_FFDIR="$(find ~/.mozilla/firefox -maxdepth 1 -type d -name '*.default-release')" | ||
MM_FFNDIR="$(find ~/.mozilla/firefox -maxdepth 1 -type d -name '*.default-nightly')" | ||
MM_FFADIR="$(find ~/.mozilla/firefox -maxdepth 1 -type d -name '*.dev-edition-default')" | ||
MM_FFEDIR="$(find ~/.mozilla/firefox-esr -maxdepth 1 -type d -name '*.default-esr*')" | ||
|
||
for DIR in "${MM_FFDIR}" "${MM_FFNDIR}" "${MM_FFADIR}" "${MM_FFEDIR}"; do | ||
cp .gitpod/user.js "${DIR}" | ||
ln -sf "${GITPOD_REPO_ROOTS}/IE6/chrome" "${DIR}/chrome" | ||
done | ||
sudo apt-get remove -y firefox | ||
|
||
mkdir -p ~/.local/share/applications | ||
cp .gitpod/firefox-nightly.desktop ~/.local/share/applications/firefox-nightly.desktop | ||
cp .gitpod/firefox-aurora.desktop ~/.local/share/applications/firefox-aurora.desktop | ||
|
||
# In case a prior installation has failed. | ||
sudo rm -rf /opt/firefox | ||
|
||
declare -A firefox_versions=( | ||
["firefox-regular"]="firefox-latest" | ||
["firefox-esr"]="firefox-esr-latest" | ||
["firefox-nightly"]="firefox-nightly-latest" | ||
["firefox-developer"]="firefox-devedition-latest" | ||
) | ||
|
||
for version in "${!firefox_versions[@]}"; do | ||
product=${firefox_versions[$version]} | ||
existed=0 | ||
|
||
echo "" | ||
echo "🦊 Installing: ${version}" | ||
echo "---------------------------------------" | ||
|
||
if [ -d "/opt/${version}" ]; then | ||
existed=1 | ||
echo "ℹ️ Detected existing install, reinstalling..." | ||
echo "> sudo rm -r \"/opt/${version}\"" | ||
sudo rm -r "/opt/${version}" | ||
fi | ||
|
||
if [ ! -f "/opt/${version}.tar.bz2" ]; then | ||
echo "> wget -q -O \"/opt/${version}.tar.bz2\" \"https://download.mozilla.org/?product=${product}&os=linux64&lang=en-US\"" | ||
sudo wget -q -O "/opt/${version}.tar.bz2" "https://download.mozilla.org/?product=${product}&os=linux64&lang=en-US" | ||
else | ||
echo "ℹ️ ${version} has already been downloaded. Skipping..." | ||
fi | ||
|
||
echo "> sudo tar -xjf \"/opt/${version}.tar.bz2\" -C /opt" | ||
sudo tar -xjf "/opt/${version}.tar.bz2" -C /opt | ||
|
||
echo "> sudo mv /opt/firefox \"/opt/${version}\"" | ||
sudo mv /opt/firefox "/opt/${version}" | ||
|
||
if [ $existed -eq 0 ]; then | ||
echo "> ln -sf \"/opt/${version}/firefox\" \"/usr/local/bin/${version}\"" | ||
sudo ln -sf "/opt/${version}/firefox" "/usr/local/bin/${version}" | ||
|
||
|
||
echo "> /opt/${version}/firefox -CreateProfile $version" | ||
/opt/${version}/firefox -CreateProfile $version | ||
exit_status=$? | ||
|
||
if [ $exit_status -eq 0 ]; then | ||
DIR="$(find ~/.mozilla/firefox -maxdepth 1 -type d -name "*.${version}")" | ||
|
||
echo "> cp .gitpod/user.js \"${DIR}\"" | ||
cp .gitpod/user.js "${DIR}" | ||
|
||
echo "> ln -sf \"${GITPOD_REPO_ROOTS}/IE6/chrome\" \"${DIR}/chrome\"" | ||
ln -sf "${GITPOD_REPO_ROOTS}/IE6/chrome" "${DIR}/chrome" | ||
|
||
cat << EOF > ~/Desktop/${version}.desktop | ||
[Desktop Entry] | ||
Version=1.0 | ||
Name=${version} | ||
GenericName=Web Browser | ||
Exec=/opt/${version}/firefox -P ${version} %u | ||
Icon=/opt/${version}/browser/chrome/icons/default/default128.png | ||
Terminal=false | ||
Type=Application | ||
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; | ||
StartupNotify=true | ||
Categories=Network;WebBrowser; | ||
Keywords=web;browser;internet; | ||
EOF | ||
|
||
sudo chmod +x ~/Desktop/${version}.desktop | ||
cp ~/Desktop/${version}.desktop ~/.local/share/applications/${version}.desktop | ||
else | ||
echo "❌ A problem occurred during profile creation. Skipping ${version}..." | ||
fi | ||
else | ||
echo "ℹ️ Since ${version} was already installed, let's skip the gubbins." | ||
fi | ||
done | ||
|
||
echo "" | ||
echo "🚀 Script has concluded - Firefox (of various variants) installed!" |