From c7b1a8349bd4d1f5328479daf3813f3c8e134675 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Wed, 11 Aug 2021 19:25:29 -0500 Subject: [PATCH] testing SNAP_REAL_HOME --- lib/install.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/install.go b/lib/install.go index 9e18f58f..935fca23 100644 --- a/lib/install.go +++ b/lib/install.go @@ -288,12 +288,14 @@ func InstallableBinLocation(userBin string) string { } /* Setup for SNAPCRAFT Users */ - SNAP := os.Getenv("SNAP_USER_COMMON") + SNAP := os.Getenv("SNAP_REAL_HOME") if SNAP != "" { //if SNAP_USER_COMMON env is set, install - CreateDirIfNotExist(filepath.Join(usr.HomeDir, "bin")) - fmt.Printf("Installing terraform at %s\n", filepath.Join(usr.HomeDir, "bin")) - fmt.Printf("RUN `export PATH=$PATH:%s` to append bin to $PATH\n", filepath.Join(usr.HomeDir, "bin")) - return filepath.Join(usr.HomeDir, "bin", "terraform") + snapHomePath := filepath.Join(SNAP, "bin") + fmt.Println(snapHomePath) + CreateDirIfNotExist(snapHomePath) + fmt.Printf("Installing terraform at %s\n", snapHomePath) + fmt.Printf("RUN `export PATH=$PATH:%s` to append bin to $PATH\n", snapHomePath) + return filepath.Join(snapHomePath, "terraform") } existDefaultBin := CheckDirExist(userBin) //the default is /usr/local/bin but users can provide custom bin locations