-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache: add win32-background-launcher to the cached binaries
on a released crc version the win32-background-laucher will be installed in the install location of crc by the msi, but while using a non installer version this'll help to download the win32-background-launcher binary by running `crc setup` this is also helpful for testing different versions of the background launcher during development
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cache | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/crc-org/crc/v2/pkg/crc/constants" | ||
"github.com/crc-org/crc/v2/pkg/crc/version" | ||
"github.com/crc-org/crc/v2/pkg/os/windows/powershell" | ||
) | ||
|
||
func NewWin32BackgroundLauncherCache() *Cache { | ||
url := constants.GetCRCWindowsBackgroundLauncherDownloadURL() | ||
version := version.GetWin32BackgroundLauncherVersion() | ||
return newCache(constants.Win32BackgroundLauncherPath(), | ||
url, | ||
version, | ||
func(executable string) (string, error) { | ||
stdOut, stdErr, err := powershell.Execute(fmt.Sprintf(`(Get-Item '%s').VersionInfo.FileVersion`, executable)) | ||
if err != nil { | ||
return "", fmt.Errorf("unable to get version: %s: %w", stdErr, err) | ||
} | ||
return strings.TrimSpace(stdOut), nil | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters