Skip to content

Instantly share code, notes, and snippets.

@lassekongo83
Last active August 24, 2023 12:46
Show Gist options
  • Save lassekongo83/0ae1d70fbb32a0c560d393e3ff8a0e5d to your computer and use it in GitHub Desktop.
Save lassekongo83/0ae1d70fbb32a0c560d393e3ff8a0e5d to your computer and use it in GitHub Desktop.
No snap, no repository, no flatpak? Just use the stand-alone Firefox binary.
#!/bin/sh
# Firefox stand-alone install script
# This script will download and install the latest Firefox stable tar and create a desktop file for it.
# The Firefox stand-alone binary auto-updates just like on Windows, so no repository needed.
# Change the 2 variables below to match your preference.
# Change to where you want Firefox installed. ~/.local/bin is the default.
# This must be the full path. Do not use tilde ~ like "~/something".
install_loc="/home/${USER}/.local/bin"
# (Optional)
# Change this to your locale. Do not use _ underscores. Default is set to en-US.
# Available Firefox locales can be found here: https://www.mozilla.org/locales
# (The last letters in the url while hovered will show your locale. For example sv-SE for Swedish.)
# Your locale can be changed within Firefox later.
my_locale="en-US"
# Let's get started...
mkdir -p ${install_loc} && mkdir -p ~/.local/share/applications
cd ${install_loc}
wget -O firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=${my_locale}"
tar -xvf firefox.tar.bz2
# Create the desktop file
touch firefox-stable.desktop
# Feel free to edit/translate the generic-name and comment to whatever you like
desktop-file-edit \
--set-name="Firefox" \
--set-generic-name="Web Browser" \
--set-comment="Browse the Web" \
--set-icon="${install_loc}/firefox/browser/chrome/icons/default/default128.png" \
--add-category="Network;WebBrowser;" \
--add-mime-type="text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;" \
--set-key="Keywords" --set-value="web;browser;internet;" \
--set-key="Exec" --set-value="${install_loc}/firefox/firefox-bin %u" \
--set-key="Type" --set-value="Application" \
--set-key="StartupWMClass" --set-value="firefox" \
--set-key="StartupNotify" --set-value="true" \
firefox-stable.desktop
desktop-file-validate firefox-stable.desktop
desktop-file-install --dir=/home/${USER}/.local/share/applications firefox-stable.desktop
update-desktop-database ~/.local/share/applications
# Cleanup
rm firefox.tar.bz2 firefox-stable.desktop
# Tip: If you want to run firefox from the commandline you can create an alias in ~/.bashrc
# alias firefox='/home/${USER}/.local/bin/firefox/firefox-bin'
# (Change it to your install location if required)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment