Skip to content

Instantly share code, notes, and snippets.

@alexdelorenzo
Last active April 10, 2022 02:28
Show Gist options
  • Save alexdelorenzo/041f1d28df63419527bd189390a0595a to your computer and use it in GitHub Desktop.
Save alexdelorenzo/041f1d28df63419527bd189390a0595a to your computer and use it in GitHub Desktop.
Install Firefox with Global Menu patches on Ubuntu derived Linux distributions. https://alexdelorenzo.dev/notes/firefox-global-menu
#!/usr/bin/env bash
# Copyright 2022 Alex DeLorenzo. Licensed under the AGPLv3.
#
# This script requires Bash, byobu, curl, and pup. You can find the latter here:
# https://github.com/ericchiang/pup
# For more information, see https://alexdelorenzo.dev/notes/firefox-global-menu
#
# Usage:
# $ ./install_ff.sh amd64
readonly ARCH="${1:-amd64}"
readonly URL="https://packages.ubuntu.com/bionic/$ARCH/firefox/download"
readonly DEB_PATH="div#content > ul > li > a attr{href}"
readonly debUrl="$(curl -s "$URL" | pup "$DEB_PATH")"
readonly debFile="$(basename "$debUrl")"
# download if file does not exist
test -e "$debFile" || {
printf "Downloading %s\n" "$debUrl"
curl -O "$debUrl"
}
# get current and downloaded firefox versions
currVer="$(apt show firefox | grep Version | col2 | cut -d- -f1)"
downloadVer="$(dpkg -I "$debFile" | grep Version | col2 | cut -d- -f1)"
printf "Installed: %s\n" "$currVer"
printf "Downloaded: %s\n" "$downloadVer"
# check if installed version is different from downloaded version
test "$currVer" != "$downloadVer" && {
# install
sudo apt install ./"$debFile"
# hold version
sudo apt-mark hold firefox
}
@alexdelorenzo
Copy link
Author

alexdelorenzo commented Dec 20, 2021

Thanks for the heads up about the byobu dependency, @rbreaves.

I haven't had problems with the sizes of the window buttons, but that might be because I'm using KWin and its default window decorations, and not Firefox's.

pup is packaged for Sid, as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment