From 0733afe6f9a125d5f027c00369c8f9b36ede315d Mon Sep 17 00:00:00 2001 From: Dustin Davis <1dustindavis@gmail.com> Date: Sun, 12 Aug 2018 19:52:20 -0700 Subject: [PATCH] Added support for installing with a Powershell script --- pkg/installer/installer.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index 422ffbe..ac0f5bb 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -139,8 +139,10 @@ func Install(item catalog.Item, cachePath string, verbose bool, repoURL string) fmt.Println("EXE support not added yet:", fileName) return } else if fileExt == ".ps1" { - fmt.Println("Powershell support not added yet:", fileName) - return + fmt.Println("Installing via Powershell:", fileName) + installCmd = filepath.Join(os.Getenv("WINDIR"), "system32/", "WindowsPowershell", "v1.0", "powershell.exe") + installArgs = []string{"-NoProfile", "-NoLogo", "-NonInteractive", "-WindowStyle", "Normal", "-ExecutionPolicy", "Bypass", "-File", absFile} + } else { fmt.Println("Unable to install", fileName) fmt.Println("Installer type unsupported:", fileExt) @@ -285,12 +287,12 @@ func Upgrade(item catalog.Item, cachePath string, verbose bool, repoURL string) } else if fileExt == ".ps1" { fmt.Println("Powershell support not added yet:", fileName) return - } else { - fmt.Println("Unable to install", fileName) - fmt.Println("Installer type unsupported:", fileExt) - return } + fmt.Println("Unable to install", fileName) + fmt.Println("Installer type unsupported:", fileExt) + return + runCommand(installCmd, installArgs, verbose) return