-
-
Save sdumetz/f0d73f6bd8c7c2f0cb8065fb81b96c72 to your computer and use it in GitHub Desktop.
| #!/bin/sh | |
| #Install firefox official stable release on debian stretch and consorts | |
| set -e | |
| TMP="$(mktemp -d)" | |
| install_base="/usr/local" | |
| echo "downloading latest firefox release..." | |
| wget -O "$TMP/FirefoxSetup.tar.bz2" "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=fr" | |
| echo "removing old firefox binaries" | |
| test -d "$install_base/lib/firefox" && rm -rf "$install_base/lib/firefox" | |
| echo "extracting..." | |
| tar -C "$install_base/lib" -xjf "$TMP/FirefoxSetup.tar.bz2" | |
| rm -rf "$TMP" | |
| echo "Creating executable..." | |
| ln -f -s "$install_base/lib/firefox/firefox-bin" "$install_base/bin/firefox" | |
| echo "Installing desktop entry..." | |
| mkdir -p "$install_base/share/applications" | |
| cat > "$install_base/share/applications/firefox.desktop" << EOF | |
| [Desktop Entry] | |
| Name=Firefox | |
| Comment=Browse the World Wide Web | |
| GenericName=Web Browser | |
| X-GNOME-FullName=Firefox Upstream Browser | |
| Exec=/usr/local/lib/firefox/firefox-bin %u | |
| Terminal=false | |
| X-MultipleArgs=false | |
| Type=Application | |
| Icon=firefox | |
| Categories=Network;WebBrowser; | |
| MimeType=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; | |
| StartupWMClass=Firefox | |
| StartupNotify=true | |
| EOF | |
| echo "Installing icons" | |
| #some dirs might not exist | |
| icons_base="$install_base/share/icons/hicolor" | |
| #usage : link_icon <src> <size> | |
| copy_icon(){ | |
| local src="$1" | |
| local size="$2" | |
| local destdir="$icons_base/${size}x${size}/apps" | |
| test -d "$destdir" || mkdir -p "$destdir" | |
| echo "\tcopying $destdir/firefox.png" | |
| test -f "$destdir/firefox.png" || cp "$src" "$destdir/firefox.png" | |
| } | |
| #default128.png default16.png default32.png default48.png default64.png | |
| ( | |
| set -e | |
| cd "$install_base/lib/firefox" | |
| for icon in browser/chrome/icons/default/default*.png ; do | |
| size="$(echo -n "$icon" | sed -e 's/^.*default\([[:digit:]]\+\).png/\1/')" #get size | |
| copy_icon "$(pwd)/$icon" "$size" | |
| done | |
| ) | |
| update-alternatives --install /usr/bin/x-www-browser x-www-browser "$install_base/bin/firefox" 80 | |
| update-alternatives --set x-www-browser /usr/local/bin/firefox | |
Working great! Thanks for this useful gist.
For coherence purposes with https://wiki.debian.org/Firefox can't we use
install_base = "/opt"And what is the real purpose of copying icons?
Can't we use
Icon=$install_base/lib/firefox/browser/chrome/icons/default/default128.pngin firefox.desktop ?
Which folder is best-suited is a bit unclear TBH. I used /usr/local because then /usr/local/bin/firefox will automatically be in path for everyone on the computer. I think it's not a good practice to have a binary in /usr/local link back to /opt, but if you're fine with having to add /opt/firefox/bin to your path, or an aliasor whatever, I don't see how it could go wrong.
You can also provide a full path to firefox's icon in firefox.desktop but your desktop environment won't be able to use the best-suited resolution from the multiple choices. It is admitedly not that great of a loss because firefox's icons are essentially the same at every resolution, but it's considered good practice.
I came across this and I finally agree with you.
I am a bit messing around with your gist but finally I'll keep it just as it is.
Thanks again!
Just to be clear : did you put the firefox symlink in /urs/local/bin on purpose? Because I'm afraid that /usr/bin/firefox symlink to firefox-esr will override it
It should not. /usr/local/bin is generally before /usr/bin in PATH so the local version will be used. It's even used as the default browser handler because it runs update-alternatives at the end.
command to Install & update lastest firefox on debian (tested for buster), without conflicting on firefox ESR.