Skip to content

Instantly share code, notes, and snippets.

@cking
Last active July 10, 2020 14:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cking/8be0bf9a030940df3de7eeeab582180e to your computer and use it in GitHub Desktop.
Save cking/8be0bf9a030940df3de7eeeab582180e to your computer and use it in GitHub Desktop.
FFXIV Launcher Updater for Lutris

Needs:

  • unzip (to extract the nupkg archive)
  • zenity (to show fancy progress bars)
  • curl (to do the actual web request)
  • jq (to parse the json returned by github api)
  • wrestool (provided by gnome-exe-thumbnailer and/or icoutils, to parse version info of local xiv launcher)
  • tr, sed (for parsing the output of wrestool)
  • mv, rm (to move files around)
#!/bin/bash
SILENT=false
while getopts "s" options; do
case "${options}" in
s)
SILENT=true
;;
esac
done
REMOTE_VERSION=$(curl -sSL https://api.github.com/repos/goatcorp/FFXIVQuickLauncher/releases/latest 2>/dev/null | jq -r .tag_name)
LOCAL_VERSION=$(wrestool -xRt version "$PWD/drive_c/XIVLauncher/XIVLauncher.exe" | tr '\0, ' '\t.\0' | sed 's/\t\t/_/g' | tr -c -d '[:print:]' | sed -r -n 's/.*Version[^0-9]*([0-9]+\.[0-9]+(\.[0-9][0-9]?)?).*/\1/p')
if [ $REMOTE_VERSION == $LOCAL_VERSION ]; then
$SILENT || zenity --info "Already up to date!"
exit
fi
(
echo "# Fetching release..."
URL=$(curl https://api.github.com/repos/goatcorp/FFXIVQuickLauncher/releases/latest 2>/dev/null | jq -r '.assets[] | select(.name | contains("-full.")) | .browser_download_url')
echo "# Downloading release..."
curl -sSL $URL > "$PWD/nupkg.zip" 2>&1
echo "# Extracting release..."
unzip "$PWD/nupkg.zip" -d "$PWD/nupkg"
echo "# Purging old XIV Launcher..."
rm -r "$PWD/drive_c/XIVLauncher"
echo "# Replacing with new Version..."
mv "$PWD/nupkg/lib/net45" "$PWD/drive_c/XIVLauncher"
echo "# Cleaning up..."
rm -r "$PWD/nupkg" "$PWD/nupkg.zip"
) | zenity --progress --text "Updating XIV Launcer" --pulsate --no-cancel --auto-close
$SILENT || zenity --info "Update successful!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment