Skip to content

Instantly share code, notes, and snippets.

@trwatson
Created August 17, 2016 21:40
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 trwatson/f97aa8ec2a45a5ba3f1f8b5c48fa037f to your computer and use it in GitHub Desktop.
Save trwatson/f97aa8ec2a45a5ba3f1f8b5c48fa037f to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -a /Applications/YakYak.app/Contents/Info.plist ]
then
YAK_INSTALLED=1
YAK_CUR_VERS=$(cat /Applications/YakYak.app/Contents/Info.plist | grep -A1 CFBundleVersion | grep '<string' | cut -f2 -d">"|cut -f1 -d"<" | tr -d '.')
else
YAK_INSTALLED=0
YAK_CUR_VERS=0
fi
YAK_STABLE_VERS=$(curl -sL https://github.com/yakyak/yakyak/releases/latest | grep -we "yakyak/yakyak/releases/download/.*/yakyak-osx.app.zip" | awk -F'\/' '{print $6}' | tr -d '.' | tr -d 'v')
YAK_URL="https://github.com/yakyak/yakyak/releases/download/${YAK_VERS}/yakyak-osx.app.zip"
echo "Installed version: ${YAK_CUR_VERS}"
echo "Latest Available: ${YAK_STABLE_VERS}"
if [ "$YAK_STABLE_VERS" -gt "$YAK_CUR_VERS" ]
then
read -r -p "Upgrade? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
YAK_ZIP="$HOME/Downloads/yakyak-latest.zip"
curl -s ${YAK_ULR} -o $YAK_ZIP
unzip $YAK_ZIP
mv -v $HOME/YakYak.app /Applications/
;;
*)
echo "ABORTED!"
;;
esac
else
echo "Up to date, nothing to do."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment