Created
August 23, 2017 17:36
-
-
Save vonHabsi/64f63e69c49191b3e0392f5300bf3237 to your computer and use it in GitHub Desktop.
download firefox nightly
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
#!/bin/bash | |
set -e | |
set -x | |
usage() | |
{ | |
cat << EOF | |
dl_ff_nightly - download and install a firefox nightly version | |
usage: $0 options | |
OPTIONS: | |
-d link default binary to downloaded | |
-s stripdashes from build version directory name | |
-b build version directory by YYYY-MM-DD-HH-MM-SS in ftp listings | |
-v specify firefox version | |
EOF | |
} | |
# firefox version | |
FFVER=57 | |
STRIPDASHES=1 | |
MAKEDEFAULT=1 | |
while getopts b:d:s:v: OPTION | |
do | |
case $OPTION in | |
b) | |
BUILDPATH=$OPTARG | |
;; | |
d) | |
MAKEDEFAULT= | |
;; | |
s) | |
STRIPDASHES= | |
;; | |
v) | |
FFVER=$OPTARG | |
;; | |
?) | |
usage | |
exit | |
;; | |
esac | |
done | |
if [[ -z $BUILDPATH ]] | |
then | |
echo "build version path is required" | |
usage | |
exit 1 | |
fi | |
YEAR="$(echo $BUILDPATH | cut --delimiter=- --fields=1)" | |
MONTH="$(echo $BUILDPATH | cut --delimiter=- --fields=2)" | |
BUILDTAG="$(echo $BUILDPATH | sed 's/[\._-]//g')" | |
PATHTAG=$BUILDPATH | |
if [[ $STRIPDASHES ]] | |
then | |
PATHTAG=$BUILDTAG | |
fi | |
outfile=firefox-${FFVER}.0a1.en-GB.linux-x86_64.${PATHTAG}.tar.bz2 | |
url=http://ftp.mozilla.org/pub/firefox/nightly/${YEAR}/${MONTH}/${BUILDPATH}-mozilla-central-l10n/firefox-${FFVER}.0a1.en-GB.linux-x86_64.tar.bz2 | |
# I prefer to save archives in case they are not available from the ftp | |
# site anymore | |
# if you have lots of archives, it may be a good idea to link the packages | |
# directory to a separate volume, you can disconnect or dismount without | |
# problems, ie a location you don't need to backup with your main server | |
cd /usr/src/packages/firefox | |
wget $url -O ${outfile} | |
mkdir -p /opt/firefox/nightly/${FFVER}/${PATHTAG} | |
# extracted to tmpdir rather than target dir in order to avoid | |
# replicating firefox directory under $PATHTAG directory | |
tmpdir=$(mktemp -d /tmp/ff_nightlies.XXXXXX) | |
mkdir -p $tmpdir | |
tar jxf ${outfile} -C $tmpdir | |
mv $tmpdir/firefox/* /opt/firefox/nightly/${FFVER}/${PATHTAG} | |
rm -rf $tmpdir | |
# setting as default not supported yet | |
# if [[ $MAKEDEFAULT ]] | |
#then | |
#$defdir=/opt/firefox/nightly/bin | |
# if [ ! -L $ | |
# PATHTAG=$BUILDTAG | |
# fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment