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