diff --git a/powershell/install-cloudbase-init-windows.ps1 b/powershell/install-cloudbase-init-windows.ps1 index a93c8a0..0a5af4a 100644 --- a/powershell/install-cloudbase-init-windows.ps1 +++ b/powershell/install-cloudbase-init-windows.ps1 @@ -1,12 +1,18 @@ # Installs 64-bit Cloudbase-init on Microsoft Windows system -$cloudbaseInitVersion = "1.1.2" + ### DO NOT EDIT BEYOND HERE ### -$cloudbaseInitVersionUnderscore = $cloudbaseInitVersion.replace(".","_") -$cloudbaseInitInstallerUri = "https://github.com/cloudbase/cloudbase-init/releases/download/${cloudbaseInitVersion}/CloudbaseInitSetup_${cloudbaseInitVersionUnderscore}_x64.msi" -$cloudbaseInitInstaller = Split-Path $cloudbaseInitInstallerUri -Leaf +$githubLatestReleases = 'https://api.github.com/repos/cloudbase/cloudbase-init/releases/latest' + +$releases = Invoke-WebRequest $githubLatestReleases | ConvertFrom-Json + +$latestx64release = $releases.assets | ? {$_.name -like '*x64.msi'} + +$cloudbaseInitInstallerUri = $latestx64release.browser_download_url + +$cloudbaseInitInstaller = $latestx64release.name $cloudbaseInitInstallPath = "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\" $cloudbaseInitConfigFile = "cloudbase-init.conf" @@ -84,4 +90,4 @@ Write-Host "Enabling automatic startup for Cloudbase-init ..." Get-Service -Name cloudbase-init | Set-Service -StartupType Automatic Write-Host "Cleaning up Cloudbase-Init installer ..." -Remove-Item C:\$cloudbaseInitInstaller -Confirm:$false \ No newline at end of file +Remove-Item C:\$cloudbaseInitInstaller -Confirm:$false