SHARE
TWEET

download firefox nightly

vfclists Aug 23rd, 2017 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. set -e
  4. set -x
  5. usage()
  6. {
  7. cat << EOF
  8.  
  9.  
  10. dl_ff_nightly - download and install a firefox nightly version
  11.  
  12. usage: $0 options
  13.  
  14.  
  15. OPTIONS:
  16.   -d    link default binary to downloaded
  17.   -s    stripdashes from build version directory name
  18.   -b    build version directory by YYYY-MM-DD-HH-MM-SS in ftp listings
  19.   -v    specify firefox version
  20. EOF
  21. }
  22.  
  23. # firefox version
  24. FFVER=57
  25. STRIPDASHES=1
  26. MAKEDEFAULT=1
  27.  
  28. while getopts b:d:s:v: OPTION
  29. do
  30.      case $OPTION in
  31.          b)
  32.              BUILDPATH=$OPTARG
  33.              ;;
  34.          d)
  35.              MAKEDEFAULT=
  36.              ;;
  37.          s)
  38.              STRIPDASHES=
  39.              ;;
  40.          v)
  41.              FFVER=$OPTARG
  42.              ;;
  43.          ?)
  44.              usage
  45.              exit
  46.              ;;
  47.      esac
  48. done
  49.  
  50. if  [[ -z $BUILDPATH ]]
  51. then
  52.   echo "build version path is required"
  53.   usage
  54.   exit 1
  55. fi
  56.  
  57.  
  58. YEAR="$(echo $BUILDPATH | cut --delimiter=- --fields=1)"
  59. MONTH="$(echo $BUILDPATH | cut --delimiter=- --fields=2)"
  60.  
  61. BUILDTAG="$(echo $BUILDPATH | sed 's/[\._-]//g')"
  62.  
  63. PATHTAG=$BUILDPATH
  64.  
  65. if  [[ $STRIPDASHES ]]
  66. then
  67.   PATHTAG=$BUILDTAG
  68. fi
  69.  
  70. outfile=firefox-${FFVER}.0a1.en-GB.linux-x86_64.${PATHTAG}.tar.bz2
  71.  
  72. url=http://ftp.mozilla.org/pub/firefox/nightly/${YEAR}/${MONTH}/${BUILDPATH}-mozilla-central-l10n/firefox-${FFVER}.0a1.en-GB.linux-x86_64.tar.bz2
  73.  
  74. # I prefer to save archives in case they are not available from the ftp
  75. # site anymore
  76. # if you have lots of archives, it may be a good idea to link the packages
  77. # directory to a separate volume, you can disconnect or dismount without
  78. # problems, ie a location you don't need to backup with your main server
  79.  
  80. cd /usr/src/packages/firefox
  81.  
  82. wget $url -O ${outfile}
  83. mkdir  -p /opt/firefox/nightly/${FFVER}/${PATHTAG}
  84.  
  85. # extracted to tmpdir rather than target dir in order to avoid
  86. # replicating firefox directory under $PATHTAG directory
  87. tmpdir=$(mktemp -d /tmp/ff_nightlies.XXXXXX)
  88. mkdir -p $tmpdir
  89. tar jxf ${outfile} -C $tmpdir
  90.  
  91. mv $tmpdir/firefox/* /opt/firefox/nightly/${FFVER}/${PATHTAG}
  92.  
  93. rm -rf $tmpdir
  94.  
  95. # setting as default not supported yet
  96.  
  97. # if  [[ $MAKEDEFAULT ]]
  98. #then
  99.   #$defdir=/opt/firefox/nightly/bin
  100. #  if [ ! -L $
  101. # PATHTAG=$BUILDTAG
  102. # fi
RAW Paste Data
Pastebin PRO Autumn Special!
Get 40% OFF on Pastebin PRO accounts!
Top