Skip to content

Instantly share code, notes, and snippets.

@jyc
Created September 16, 2012 05:06
Show Gist options
  • Select an option

  • Save jyc/3731086 to your computer and use it in GitHub Desktop.

Select an option

Save jyc/3731086 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Installation directory - change this to a directory of your choice
# Please make sure the directory exists first, or the script won't work
INSTALLDIR=$HOME
# Determine the architecture of the machine in use and set variables accordingly
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i686) ARCH=i686 ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i686" ]; then
DIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
DIRSUFFIX="_x64"
else
echo "The ARCH should be either i686 or x86_64. Exiting."
exit
fi
# Determine the build number of the latest build
#LATESTBUILD=$(curl http://commondatastorage.googleapis.com/chromium-browser-continuous/Linux/LAST_CHANGE)
curl http://omahaproxy.appspot.com/all?csv=1 > /tmp/chrome-omaha.csv
while IFS=, read os chan curr_ver prev_ver curr_rdate prev_rdate base_trunk_rev branch_rev base_wk_rev true_branch wk_ver v8_ver
do
if [[ "$os" == "linux" && "$chan" == "stable" ]]; then
LATESTBUILD=$base_trunk_rev
fi
done < /tmp/chrome-omaha.csv
# The URL to download from
CHROMEURL="http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux"$DIRSUFFIX/$LATESTBUILD/"chrome-linux.zip"
cd $INSTALLDIR
if [ -e chrome-linux.zip ]; then # Check to see if `chrome-linux.zip` already exists
mv chrome-linux.zip chrome-linux.zip.old # if it does, rename it to chrome-linux.zip.old as backup
fi # in case the current build has problems
wget -O chrome-linux.zip $CHROMEURL
unzip -u -o ./chrome-linux.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment