Simplify Python script (#71)
This commit is contained in:
		
							
								
								
									
										23
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								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:
 | 
			
		||||
  exit()
 | 
			
		||||
if "message" in r:
 | 
			
		||||
    exit()
 | 
			
		||||
for release in r:
 | 
			
		||||
  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():
 | 
			
		||||
    print(image_url)
 | 
			
		||||
    break
 | 
			
		||||
    if release["prerelease"]:
 | 
			
		||||
        continue
 | 
			
		||||
    for asset in release["assets"]:
 | 
			
		||||
        if asset["name"].endswith("$RELEASE_EXT"):
 | 
			
		||||
            image_url = asset["browser_download_url"]
 | 
			
		||||
            print(image_url)
 | 
			
		||||
            exit()
 | 
			
		||||
EOF
 | 
			
		||||
)
 | 
			
		||||
if [ -z "$URL" ]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user