Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active January 3, 2016 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardo82/9e815aa00ab4c361e60c to your computer and use it in GitHub Desktop.
Save dardo82/9e815aa00ab4c361e60c to your computer and use it in GitHub Desktop.
Chromium Updater
#!/bin/zsh
APP="${${0##*/}%-*}; OST="mac"; DAZ="${APP/ium/e}-$OST.zip"
URL="https://commondatastorage.googleapis.com/$APP-browser-snapshots/${(C)OST}"
ASS="$(curl -s $URL/LAST_CHANGE)"
ADA="${$(brew cask info $APP|awk -v ORS=/ '/^(\/| )/{print $1}')%/*}"
SCM="$(awk -F'#|}' '/#/{print $3}' $ADA/Contents/Info.plist)"
if [ $SCM -lt $ASS ]; then
cd $TMPDIR; pkill ${(C)APP}
curl -O $URL/$ASS/$DAZ; unzip $DAZ
mv -frv ${DAZ%.*}/${$ADA##*/} $ADA
rm -frv ${DAZ%.*}*; open $ADA
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment