mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
Fix windows build
This commit is contained in:
@@ -19,7 +19,19 @@ const (
|
||||
uninstallKeyPath32 = `SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Netbird`
|
||||
)
|
||||
|
||||
func (u *UpdateManager) installationMethod() string {
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
method := installation()
|
||||
switch method {
|
||||
case "EXE":
|
||||
return updateEXE(ctx, targetVersion)
|
||||
case "MSI":
|
||||
return updateMSI(ctx, targetVersion)
|
||||
default:
|
||||
return fmt.Errorf("unsupported installation method: %s", method)
|
||||
}
|
||||
}
|
||||
|
||||
func installation() string {
|
||||
k, err := registry.OpenKey(registry.LOCAL_MACHINE, uninstallKeyPath64, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
k, err = registry.OpenKey(registry.LOCAL_MACHINE, uninstallKeyPath32, registry.QUERY_VALUE)
|
||||
@@ -64,14 +76,3 @@ func updateEXE(ctx context.Context, targetVersion string) error {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
switch installationMethod() {
|
||||
case "EXE":
|
||||
return updateEXE(ctx, targetVersion)
|
||||
case "MSI":
|
||||
return updateMSI(ctx, targetVersion)
|
||||
default:
|
||||
return fmt.Errorf("unsupported installation method: %s", installationMethod())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user