DEV Community

Cover image for Bash Script to Install FireFoxDeveloper Edition
m4r4v
m4r4v

Posted on

Bash Script to Install FireFoxDeveloper Edition

I am a big fan of firefox and since it came out with the finest distribution for developers firefox developer edition it really made my web dev life easie.

Installing it in Linux is not that easy as it is in windows or in mac, but that's the fun about linux hehe, at least it is for me.

I've seen many articles and tutorials where people explain how to install it, but most of them it just get rid of firefox and replace it with the firefox developer edition. I just like to have both browsers the released and stable version and the unstable developer version.

So far I've been doing the installation manually and every time they have a new release I had to run the same command line again and again, got boring to me and I just created my automated script for it to do it on its own.

I uploaded the script to my github update-firefox-developer-linux for everyone to use it.

let me show it to you here:

#!/bin/bash

# Source reference: https://www.rogerpence.com/posts/a-bash-script-to-install-firefox-dev-edition

function installFFDE {
    cd ~/Downloads
    ffdFile= firefox-*.tar.bz2
    tar -xvf $ffdFile
    mv firefox firefox-developer
    sudo cp -r firefox-developer/ /opt/
    echo "files were copied into /opt/"
    rm -r firefox-developer && rm -r $ffdFile
    echo "All files were removed, your're good to go"
}

function downloadAndInstallFFDE {
    curl -o releases.txt https://download-installer.cdn.mozilla.net/pub/devedition/releases/
    echo "Downloaded..."
    latest=$(grep -o '[0-9][0-9]\.[0-9][a-z][0-9]' releases.txt | tail -1)  
    echo "getting latest release...\nthe latest release is:\nfirefox-$latest.tar.bz2" 
    echo "got latest version"
    ffdFile=firefox-$latest.tar.bz2
    rm releases.txt
    curl -o $ffdFile https://download-installer.cdn.mozilla.net/pub/devedition/releases/$latest/linux-x86_64/en-US/$ffdFile
    echo "got latest version. Proceeding to install it"
    tar -xvf $ffdFile
    mv firefox firefox-developer
    sudo cp -r firefox-developer/ /opt/
    echo "files were copied into /opt/"
    rm -r firefox-developer && rm -r $ffdFile
    echo "All files were removed, your're good to go"
}

FILE=firefox-*.tar.bz2

if [ -e $FILE ]; then
    installFFDE
else 
    echo "installation file does not exists, will start downloading it now..."
    downloadAndInstallFFDE
fi
Enter fullscreen mode Exit fullscreen mode

hope you all like it, let me know any improvement suggestions and happy to help.

Don't forget to Follow, ❤️ or 🦄
Happy Coding!!!

Top comments (0)