Get the latest VMDK released

This commit is contained in:
whiskerz007 2020-05-28 16:44:13 +02:00
parent 085b0bb991
commit 2a70b855f5
No known key found for this signature in database
GPG Key ID: A7EEAB6E1F1A6805

View File

@ -84,13 +84,21 @@ msg "Getting URL for latest Home Assistant disk image..."
RELEASE_EXT=vmdk.gz RELEASE_EXT=vmdk.gz
URL=$(cat<<EOF | python3 URL=$(cat<<EOF | python3
import requests import requests
url = 'https://api.github.com/repos/home-assistant/operating-system/releases/latest' url = 'https://api.github.com/repos/home-assistant/operating-system/releases'
r = requests.get(url).json() r = requests.get(url).json()
if 'message' in r: if 'message' in r:
exit() exit()
for asset in r['assets']: for release in r:
if not release['prerelease']:
continue
for asset in release['assets']:
if asset['name'].endswith('$RELEASE_EXT'): if asset['name'].endswith('$RELEASE_EXT'):
print(asset['browser_download_url']) global image_url
image_url = asset['browser_download_url']
break
if 'image_url' in globals():
print(image_url)
break
EOF EOF
) )
if [ -z "$URL" ]; then if [ -z "$URL" ]; then