diff --git a/packaging/windows/product.wxs.template b/packaging/windows/product.wxs.template index 66d28a7a65..20a3b8b921 100755 --- a/packaging/windows/product.wxs.template +++ b/packaging/windows/product.wxs.template @@ -55,7 +55,7 @@ - + NOT UPGRADINGPRODUCTCODE AND NOT WIX_UPGRADE_DETECTED diff --git a/pkg/crc/cache/cache.go b/pkg/crc/cache/cache.go index 8e3070160e..37cb674a4d 100644 --- a/pkg/crc/cache/cache.go +++ b/pkg/crc/cache/cache.go @@ -20,6 +20,7 @@ type Cache struct { executablePath string archiveURL string version string + nameMismatch bool getVersion func(string) (string, error) } @@ -33,8 +34,8 @@ func (e *VersionMismatchError) Error() string { return fmt.Sprintf("%s version mismatch: %s expected but %s found in the cache", e.ExecutableName, e.ExpectedVersion, e.CurrentVersion) } -func newCache(executablePath string, archiveURL string, version string, getVersion func(string) (string, error)) *Cache { - return &Cache{executablePath: executablePath, archiveURL: archiveURL, version: version, getVersion: getVersion} +func newCache(executablePath string, archiveURL string, version string, nameMismatch bool, getVersion func(string) (string, error)) *Cache { + return &Cache{executablePath: executablePath, archiveURL: archiveURL, version: version, getVersion: getVersion, nameMismatch: nameMismatch} } func (c *Cache) GetExecutablePath() string { @@ -71,6 +72,7 @@ func NewAdminHelperCache() *Cache { return newCache(constants.AdminHelperPath(), url, version, + false, func(executable string) (string, error) { out, _, err := crcos.RunWithDefaultLocale(executable, "--version") if err != nil { @@ -127,14 +129,14 @@ func (c *Cache) cacheExecutable() error { } } else { extractedFiles = append(extractedFiles, assetTmpFile) - if filepath.Base(assetTmpFile) != c.GetExecutableName() { + if filepath.Base(assetTmpFile) != c.GetExecutableName() && !c.nameMismatch { logging.Warnf("Executable name is %s but extracted file name is %s", c.GetExecutableName(), filepath.Base(assetTmpFile)) } } // Copy the requested asset into its final destination for _, extractedFilePath := range extractedFiles { - finalExecutablePath := filepath.Join(constants.CrcBinDir, filepath.Base(extractedFilePath)) + finalExecutablePath := filepath.Join(constants.CrcBinDir, c.GetExecutableName()) // If the file exists then remove it (ignore error) first before copy because with `0500` permission // it is not possible to overwrite the file. os.Remove(finalExecutablePath) diff --git a/pkg/crc/cache/cache_linux.go b/pkg/crc/cache/cache_linux.go index cfb623b3eb..e153018cb7 100644 --- a/pkg/crc/cache/cache_linux.go +++ b/pkg/crc/cache/cache_linux.go @@ -5,7 +5,7 @@ import ( ) func NewMachineDriverLibvirtCache() *Cache { - return newCache(libvirt.MachineDriverPath(), libvirt.MachineDriverDownloadURL, libvirt.MachineDriverVersion, getCurrentLibvirtDriverVersion) + return newCache(libvirt.MachineDriverPath(), libvirt.MachineDriverDownloadURL, libvirt.MachineDriverVersion, false, getCurrentLibvirtDriverVersion) } func getCurrentLibvirtDriverVersion(executablePath string) (string, error) { diff --git a/pkg/crc/cache/cache_windows.go b/pkg/crc/cache/cache_windows.go index 95fc566b20..4c0f4bfe3b 100644 --- a/pkg/crc/cache/cache_windows.go +++ b/pkg/crc/cache/cache_windows.go @@ -15,6 +15,7 @@ func NewWin32BackgroundLauncherCache() *Cache { return newCache(constants.Win32BackgroundLauncherPath(), url, version, + true, func(executable string) (string, error) { stdOut, stdErr, err := powershell.Execute(fmt.Sprintf(`(Get-Item '%s').VersionInfo.FileVersion`, executable)) if err != nil { diff --git a/pkg/crc/constants/constants.go b/pkg/crc/constants/constants.go index 7a3a9f0947..486d9e3d63 100644 --- a/pkg/crc/constants/constants.go +++ b/pkg/crc/constants/constants.go @@ -27,7 +27,7 @@ const ( DaemonLogFile = "crcd.log" CrcLandingPageURL = "https://console.redhat.com/openshift/create/local" // #nosec G101 DefaultAdminHelperURLBase = "https://github.com/crc-org/admin-helper/releases/download/v%s/%s" - BackgroundLauncherURL = "https://github.com/crc-org/win32-background-launcher/releases/download/v%s/%s" + BackgroundLauncherURL = "https://github.com/crc-org/win32-background-launcher/releases/download/v%s/win32-background-launcher.exe" DefaultBundleURLBase = "https://mirror.openshift.com/pub/openshift-v4/clients/crc/bundles/%s/%s/%s" DefaultContext = "admin" DaemonHTTPEndpoint = "http://unix/api" @@ -49,7 +49,7 @@ const ( OpenShiftIngressHTTPPort = 80 OpenShiftIngressHTTPSPort = 443 - BackgroundLauncherExecutable = "win32-background-launcher.exe" + BackgroundLauncherExecutable = "crc-background-launcher.exe" ) var adminHelperExecutableForOs = map[string]string{ @@ -196,7 +196,7 @@ func GetKubeAdminPasswordPath() string { func GetWin32BackgroundLauncherDownloadURL() string { return fmt.Sprintf(BackgroundLauncherURL, - version.GetWin32BackgroundLauncherVersion(), BackgroundLauncherExecutable) + version.GetWin32BackgroundLauncherVersion()) } func GetDefaultCPUs(preset crcpreset.Preset) int {