Skip to content

Instantly share code, notes, and snippets.

@hazcod
Created May 19, 2015 08:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazcod/a1600e891a9d8419ac1e to your computer and use it in GitHub Desktop.
Save hazcod/a1600e891a9d8419ac1e to your computer and use it in GitHub Desktop.
Update Moonlight
function version { echo "$@" | gawk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; }
function downloadFile {
echo "$1" | egrep -o "/irtimmer/moonlight-embedded/releases/download/v([0-9]\.*)+/$2" | wget -q --base=http://github.com/ -i - -O "$2"
}
function updateMoonlight {
FILE=version
releases=`curl -s -L https://github.com/irtimmer/moonlight-embedded/releases/latest`
current_version=`cat $FILE`
latest_version=`echo "$releases" | egrep -o "/releases/download/v([0-9]\.*)+/" | egrep -o "v([0-9]\.*)+" | cut -c 2- | head -n 1`
if [ ! -f "$FILE" ] || [ "$(version "$latest_version")" -gt "$(version "$current_version")" ]; then
echo "Updating moonlight to $latest_version"
downloadFile "$releases" libopus.so
downloadFile "$releases" limelight.jar
echo "$latest_version" > "$FILE"
return 0
else
echo "No update necessary, at latest version. ($latest_version)"
return 1
fi
}
updateMoonlight
@InfernoDigital
Copy link

Otherwise known as awesomeness in a text box. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment