Created
August 17, 2016 21:40
-
-
Save trwatson/f97aa8ec2a45a5ba3f1f8b5c48fa037f to your computer and use it in GitHub Desktop.
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 | |
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