A Bash script to install Firefox Dev Edition
Posted on: Saturday, Feb 03, 2018
Installing an app manually on Ubuntu isn't much of a hassle, until you need to do it many times. Such is the case with the Firefox Dev Edition (FFDE). It rolls out new versions quickly (too quickly to keep the PPAs current) and it's important to stay current. This post provides a Bash script to automate the installation of FFDE--but could easily be modified to work with other apps.
Chrome has been my-goto WebDev browser for a long time. However, since the introduction of the FireFox Quantum family, FireFox (especially the Developer Edition) has earned a spot (again) on my must-have tools. The Developer Edition's CSS Grid Inspector is especially cool. Give FireFox another chance. If only to keep Chrome honest and to not become the IE of the 21st century!
Getting the number of the most recent FFDE version
This script would have been a little simpler if Mozilla provided the most recent download in a statically named file (such as "FirefoxDevEd-current.bz2"). However, it doesn't. There is, however, a "releases" page with the FFDE downloads available, with the most recent version at the bottom of the list. To keep this script as frictionless as possible it uses
tail to scrape the most current version number from that releases page. That process is detailed in this post.
This script stores FFDE in the
/opt/firefox-devfolder. It asks for the sudo password while running.
After fetching the most recent FFDE version number and storing it in a Bash variable, this script:
- Downloads the latest FFDE installation file
- Unzips it
- Adds the target folder
- Clears out that target folder
- Copies the new version to that target folder
- Deletes unnecessary files
To uses the script below, put it a folder in your path and make it executable with:
chmod +x installffde
Then, run it with
This file makes is really easy to keep your version of Firefox Dev Edition current. The process takes about 30 seconds. See this post for instructions on creating a .desktop file for easy access to FFDE.
#!/usr/bin/env bash # Get the lastest FFDE version number. curl -o releases.txt https://download-installer.cdn.mozilla.net/pub/devedition/releases/ VERSION=$(grep -o '[0-9][0-9]\.[0-9][a-z][0-9]' releases.txt | tail -1) rm releases.txt # Get download file name. FILE=firefox-$VERSION.tar.bz2 # Create /opt/firefox-dev if it doesn't exist. if [ ! -d "/opt/firefox-dev" ] then sudo mkdir /opt/firefox-dev fi # Get Firefox download. curl -o $FILE https://download-installer.cdn.mozilla.net/pub/devedition/releases/$VERSION/linux-x86_64/en-US/$FILE # If you don't get the file you specified, you get an HTML file with a #'404 Not found' text in it. if grep -iq '404 Not found' $FILE then clear echo Error... echo $FILE did not download. rm $FILE exit fi # Unzip the install file. tar xvjf $FILE # Clear the target directory. sudo rm -rf /opt/firefox-dev/* # Move the program files to the target directory. sudo mv firefox/* /opt/firefox-dev # Remove the unzipped install folder. rm -rf firefox # Remove the install file. rm $FILE echo Firefox Dev Ed $1 installed.
Thanks Roger. This script worked perfectly.
Submitted by Amol2 months ago
Thanks for reading, Amol. Glad it worked for you.
Submitted by rp1 month ago