Skip to content

Commit

Permalink
install script now only processes bare zip files and installs into ~/…
Browse files Browse the repository at this point in the history
….nsccli/bin
  • Loading branch information
aricart committed Nov 27, 2018
1 parent 5c41b49 commit edbc1db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ func (u *SelfUpdate) updateLastChecked() error {
if err != nil {
return fmt.Errorf("error getting path for selfupdate info file: %v", err)
}
dir := filepath.Dir(fp)
if err := os.MkdirAll(dir, 0700); err != nil {
return fmt.Errorf("error creating dir %q: %v", dir, err)

}
if err := ioutil.WriteFile(fp, d, 0600); err != nil {
return fmt.Errorf("error writing %q: %v", fp, err)
}
Expand All @@ -158,7 +163,8 @@ func (u *SelfUpdate) infoFile() (string, error) {
// shouldn't prevent if there's an error
return "", fmt.Errorf("error getting homedir: %v", err.Error())
}
fn := filepath.Join(dir, fmt.Sprintf(".%s_cli", filepath.Base(os.Args[0])))
exeName := filepath.Base(os.Args[0])
fn := filepath.Join(dir, fmt.Sprintf(".%scli/%s.ini", exeName, exeName))
return fn, nil
}

Expand Down
10 changes: 7 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ def main():

print("NSC: " + exe_fn)
print("Now manually add %s to your $PATH" % bin_dir)
print("Example:")
print("Bash Example:")
print()
print(" echo export PATH=\"%s\":\\$PATH >> $HOME/.bash_profile" % bin_dir)
print(" echo 'export PATH=\"$PATH:%s\"' >> $HOME/.bash_profile" % bin_dir)
print(" source $HOME/.bash_profile")
print()
print("Zsh Example:")
print(" echo 'export PATH=\"$PATH:%s\"' >> $HOME/.zshrc" % bin_dir)
print(" source $HOME/.zshrc")
print()


def mkdir(d):
if not os.path.exists(d):
Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func main() {
version = version[1:]
}
cmd.GetRootCmd().Version = version

cmd.SetUpdateRespository("nats-io/nsc")

u, err := cmd.NewSelfUpdate()
Expand Down

0 comments on commit edbc1db

Please sign in to comment.