Simplify Python script (#71)
This commit is contained in:
parent
00352c8c4e
commit
b49feaa906
17
install.sh
17
install.sh
@ -84,21 +84,18 @@ msg "Getting URL for latest Home Assistant disk image..."
|
||||
RELEASE_EXT=vmdk.gz
|
||||
URL=$(cat<<EOF | python3
|
||||
import requests
|
||||
url = 'https://api.github.com/repos/home-assistant/operating-system/releases'
|
||||
url = "https://api.github.com/repos/home-assistant/operating-system/releases"
|
||||
r = requests.get(url).json()
|
||||
if 'message' in r:
|
||||
if "message" in r:
|
||||
exit()
|
||||
for release in r:
|
||||
if release['prerelease']:
|
||||
if release["prerelease"]:
|
||||
continue
|
||||
for asset in release['assets']:
|
||||
if asset['name'].endswith('$RELEASE_EXT'):
|
||||
global image_url
|
||||
image_url = asset['browser_download_url']
|
||||
break
|
||||
if 'image_url' in globals():
|
||||
for asset in release["assets"]:
|
||||
if asset["name"].endswith("$RELEASE_EXT"):
|
||||
image_url = asset["browser_download_url"]
|
||||
print(image_url)
|
||||
break
|
||||
exit()
|
||||
EOF
|
||||
)
|
||||
if [ -z "$URL" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user