Skip to content

Commit

Permalink
add snapsccrft option
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensbox committed Jul 30, 2021
1 parent 03d377b commit 4601962
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,15 @@ func InstallableBinLocation(userBin string) string {
log.Fatal(errCurr)
}

/* Setup for SNAPCRAFT Users */
SNAP := os.Getenv("SNAP_USER_COMMON")
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")
}

existDefaultBin := CheckDirExist(userBin) //the default is /usr/local/bin but users can provide custom bin locations

if existDefaultBin { //if exist - now see if we can write to to it
Expand Down

0 comments on commit 4601962

Please sign in to comment.