Skip to content

Instantly share code, notes, and snippets.

@zoffline
Created June 23, 2019 02:41
Show Gist options
  • Save zoffline/b874e93e24439f0f4fbd7b55f3876fd2 to your computer and use it in GitHub Desktop.
Save zoffline/b874e93e24439f0f4fbd7b55f3876fd2 to your computer and use it in GitHub Desktop.
patch-zoffline-for-update.sh
#!/bin/bash
# Script to automatically update zoffline to support the latest version of Zwift
# To update to the latest Zwift version with zoffline: Run this from within the zwift-offline repository
# Note: There is no guarantee this will be sufficient if significant changes are made to Zwift.
if [ ! -f "README.md" ]; then
echo "must be run from top of zwift-offline repo"
exit 1
fi
new_ver=$(curl -s https://cdn.zwift.com/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | egrep -o 'Zwift version="[^"]+' | cut -d\" -f2)
if [ -z "$new_ver" ]; then
echo "error: unable to obtain new version"
exit 1
fi
echo "New version is $new_ver"
cur_ver=$(grep -m1 -oP '(?<=newer than )[0-9]+\.[0-9]+\.[0-9]+' README.md)
sed -i "s/$cur_ver/$new_ver/" README.md
curl -s https://cdn.zwift.com/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | sed 's/ /\n/g' > cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml
curl -s https://cdn.zwift.com/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml | sed 's/ /\n/g' > cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment