Automating Chromium Nightly Downloads on Ubuntu with a Shell Script
As a Linux user, I have to rely on Chrome (Chromium’s rendering engine) for some rare and limited but equally essential tasks. However, the default Chromium package in Ubuntu is now a snap, which complicates matters as snaps generally cause issues I’d rather not deal with on my system. This left me out of options until I found a solution – downloading Chromium Nightly as a .zip archive and automating the process with a shell script.
In this blog post, I’ll share the script I created to download and run Chromium Nightly on Ubuntu. I’ll break down each part of the script and explain how it works.
Before we begin, note that I will not provide support for this script or any issues that may arise from using it. Additionally, please do not ask me to provide assistance with installing or using snaps – I have no experience with them and cannot help you. If you have any questions about shell scripting or Linux in general, I’ll do my best to assist you.
Now, let’s get started!
Variables and Setup
———————
First, we need to define some variables and set up our environment:
“`bash
#!/usr/bin/env bash
set -e
“`
Let’s break down each part of this code:
* `!/usr/bin/env bash`: This tells Linux to run the script with Bash. This must be the first line of the file.
* `set -e`: This sets the exit flag, which means that if any errors occur during the execution of the script, it will exit immediately instead of trying to continue.
Creating a Temporary Directory
——————————
Next, we need to create a temporary directory:
“`bash
mkdir -p ~/tmp/chromium-nightly
“`
This creates a new directory in our home directory called `chromium-nightly`.
Checking if Chromium Nightly is Already Downloaded
———————————————–
Next, we need to check if we’ve already downloaded Chromium Nightly:
“`bash
if [ -x /usr/local/bin/chrome ]; then
echo “Chromium Nightly is already downloaded.”
exit 0
fi
“`
Here’s how this code works:
* `[ -x /usr/local/bin/chrome ]` checks if the `chrome` binary exists and is executable. If it does, the command returns a zero status code (indicating success).
* `if [ … ]` executes the code inside the if statement if the previous command returns a zero status code.
* `echo “Chromium Nightly is already downloaded.”` prints the message to standard output.
* `exit 0` exits the script with a zero status code.
Downloading Chromium Nightly
—————————–
Now that we’ve checked if Chromium Nightly is already downloaded, let’s download it:
“`bash
curl -O https://chromium.woolyss.com/nightly/Linux/x64/chrome.zip
“`
This downloads the latest version of Chromium Nightly as a .zip archive from the specified URL.
Extracting Chromium Nightly
—————————-
Next, we need to extract the downloaded archive:
“`bash
unzip chrome.zip -d ~/tmp/chromium-nightly
“`
This extracts the contents of the `chrome.zip` archive into the `chromium-nightly` directory.
Running Chromium Nightly
—————————
Finally, let’s run Chromium Nightly:
“`bash
cd ~/tmp/chromium-nightly
./chrome –new-window
“`
This changes our current working directory to the `chromium-nightly` directory and starts a new instance of Chromium Nightly using the `chrome` command.
The complete script is:
“`bash
#!/usr/bin/env bash
set -e
mkdir -p ~/tmp/chromium-nightly
if [ -x /usr/local/bin/chrome ]; then
echo “Chromium Nightly is already downloaded.”
exit 0
fi
curl -O https://chromium.woolyss.com/nightly/Linux/x64/chrome.zip
unzip chrome.zip -d ~/tmp/chromium-nightly
cd ~/tmp/chromium-nightly
./chrome –new-window
“`
I hope this script helps you automate the process of downloading and running Chromium Nightly on Ubuntu! Note that I will not provide support for this script or any issues that may arise from using it. If you have any questions about shell scripting or Linux in general, I’ll do my best to assist you.