Beispiel #1
0
func netrcPath() string {
	if s := os.Getenv("NETRC_PATH"); s != "" {
		return s
	}

	return filepath.Join(hkclient.HomePath(), netrcFilename)
}
Beispiel #2
0
func findKeys() ([]byte, error) {
	if sshPubKeyPath != "" {
		return sshReadPubKey(sshPubKeyPath)
	}

	out, err := exec.Command("ssh-add", "-L").Output()
	if err != nil {
		return nil, err
	}
	if len(out) != 0 {
		print(string(out))
		return out, nil
	}

	key, err := sshReadPubKey(filepath.Join(hkclient.HomePath(), ".ssh", "id_rsa.pub"))
	switch err {
	case syscall.ENOENT:
		return nil, errors.New("No SSH keys found")
	case nil:
		return key, nil
	}
	return nil, err
}
Beispiel #3
0
func hkHome() string {
	return filepath.Join(hkclient.HomePath(), ".hk")
}