Created
March 29, 2017 08:14
-
-
Save LoveIsGrief/9d18a5efa36dc1f5e6b3dd2c06953ed1 to your computer and use it in GitHub Desktop.
The beginnings of a script to keep firefox-nightly up to date using cron.
(Maybe not necessary if firefox nightly does that itself)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Unofficial bash strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
url="https://download.mozilla.org/?product=firefox-nightly-latest-ssl&os=linux64&lang=en-US" | |
dir=~/programs/firefox/nightly | |
version=`curl -s "${url}" | sed -E 's/.*firefox-(.*)\.linux.*/\1/g'` | |
versionDir="${dir}/${version}" | |
mkdir -p ${dir} | |
cd "${dir}" | |
if [[ -e "${versionDir}" ]] ; then | |
echo "Version ${version} exists already @ ${versionDir}" | |
else | |
echo "Getting firefox-nightly ${version} into ${dir}" | |
wget --quiet -O - "${url}" | cat | tar xjvf - | |
mv firefox ${version} | |
fi | |
if ! ps faux | grep -v grep | grep "${dir}/current" ; then | |
if [[ -e "current" ]] ; then | |
rm current | |
fi | |
echo "updating current to ${version}" | |
ln -s ${version} current | |
else | |
echo "firefox nightly is running. won't upgrade yet..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment