diff --git a/net-misc/keychain/additional-files/keychain.sh b/net-misc/keychain/additional-files/keychain.sh new file mode 100644 index 000000000..381f12030 --- /dev/null +++ b/net-misc/keychain/additional-files/keychain.sh @@ -0,0 +1 @@ +type -p keychain >/dev/null && eval `keychain --quiet --eval --ignore-missing ~/config/settings/ssh/id_rsa` diff --git a/net-misc/keychain/keychain-2.8.5.recipe b/net-misc/keychain/keychain-2.8.5.recipe new file mode 100644 index 000000000..57026a3ec --- /dev/null +++ b/net-misc/keychain/keychain-2.8.5.recipe @@ -0,0 +1,48 @@ +SUMMARY="A commandline-tool to manage SSH and GPG agents" +DESCRIPTION="Keychain helps you to manage SSH and GPG keys in a convenient \ +and secure manner. It acts as a frontend to ssh-agent and ssh-add, but allows \ +you to easily have one long running ssh-agent process per system, rather than \ +the norm of one ssh-agent per login session." +HOMEPAGE="https://www.funtoo.org/Keychain" +COPYRIGHT="2002-2006 Gentoo Foundation + 2007 Aron Griffis + 2009-2017 Funtoo Solutions, Inc + lockfile() 2009 Parallels, Inc." +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="https://github.com/funtoo/keychain/archive/$portVersion.tar.gz" +CHECKSUM_SHA256="dcce703e5001211c8ebc0528f45b523f84d2bceeb240600795b4d80cb8475a0b" +PATCHES="keychain-$portVersion.patchset" +ADDITIONAL_FILES="keychain.sh" + +ARCHITECTURES="any" + +PROVIDES=" + keychain = $portVersion + cmd:keychain = $portVersion + " + +REQUIRES=" + haiku + cmd:sh + cmd:ssh_agent + cmd:ssh_add + " + +BUILD_REQUIRES=" + cmd:sh + cmd:gzip + " + +INSTALL() +{ + mkdir -p $binDir + cp -af keychain $binDir + + mkdir -p $manDir/man1 + gzip -9 keychain.1 + cp -af keychain.1.gz $manDir/man1 + + mkdir -p $dataDir/profile.d + cp -af $portDir/additional-files/keychain.sh $dataDir/profile.d +} diff --git a/net-misc/keychain/patches/keychain-2.8.5.patchset b/net-misc/keychain/patches/keychain-2.8.5.patchset new file mode 100644 index 000000000..54254cb35 --- /dev/null +++ b/net-misc/keychain/patches/keychain-2.8.5.patchset @@ -0,0 +1,136 @@ +From 2e92332e2edeb851fdec97ed4b77c69b470d76ef Mon Sep 17 00:00:00 2001 +From: Chris Roberts +Date: Mon, 16 Sep 2019 18:31:57 -0600 +Subject: [PATCH 1/1] Haiku fixes + +--- + keychain | 32 +++++++++++++++++--------------- + 1 file changed, 17 insertions(+), 15 deletions(-) + +diff --git a/keychain b/keychain +index 0eee68f..37edc54 100755 +--- a/keychain ++++ b/keychain +@@ -45,7 +45,7 @@ unset sshavail + unset sshkeys + unset gpgkeys + unset mykeys +-keydir="${HOME}/.keychain" ++keydir="${HOME}/config/settings/keychain" + unset envf + evalopt=false + queryopt=false +@@ -151,9 +151,9 @@ OPTIONS + your ssh keys when you're logged out. + + ${GREEN}--confhost${OFF} +- By default, keychain will look for key pairs in the ~/.ssh/ ++ By default, keychain will look for key pairs in the ~/config/settings/ssh/ + directory. The ${GREEN}--confhost${OFF} option will inform keychain to look in +- ~/.ssh/config for IdentityFile settings defined for particular ++ ~/config/settings/ssh/config for IdentityFile settings defined for particular + hosts, and use these paths to locate keys. + + ${GREEN}--confirm${OFF} +@@ -167,7 +167,7 @@ OPTIONS + compatibility. + + ${GREEN}--dir${OFF} ${CYAN}dirname${OFF} +- Keychain will use dirname rather than \$HOME/.keychain ++ Keychain will use dirname rather than \$HOME/config/settings/keychain + + ${GREEN}--query${OFF} + Keychain will print lines in KEY=value format representing the +@@ -181,8 +181,8 @@ OPTIONS + ${GREEN}--env${OFF} ${CYAN}filename${OFF} + After parsing options, keychain will load additional environment + settings from "filename". By default, if "--env" is not given, then +- keychain will attempt to load from ~/.keychain/[hostname]-env or +- alternatively ~/.keychain/env. The purpose of this file is to ++ keychain will attempt to load from ~/config/settings/keychain/[hostname]-env or ++ alternatively ~/config/settings/keychain/env. The purpose of this file is to + override settings such as PATH, in case ssh is stored in a + non-standard place. + +@@ -241,7 +241,7 @@ OPTIONS + + ${GREEN}--noask${OFF} + This option tells keychain do everything it normally does (ensure +- ssh-agent is running, set up the ~/.keychain/[hostname]-{c}sh files) ++ ssh-agent is running, set up the ~/config/settings/keychain/[hostname]-{c}sh files) + except that it will not prompt you to add any of the keys you + specified if they haven't yet been added to ssh-agent. + +@@ -360,7 +360,7 @@ lockfile() { + tmpfile="$lockf.$$" + + echo $$ >"$tmpfile" 2>/dev/null || exit +- if ln "$tmpfile" "$lockf" 2>/dev/null; then ++ if ln -s "$tmpfile" "$lockf" 2>/dev/null; then + rm -f "$tmpfile" + havelock=true && return 0 + fi +@@ -368,7 +368,7 @@ lockfile() { + rm -f "$tmpfile" + return 1 + fi +- if ln "$tmpfile" "$lockf" 2>/dev/null; then ++ if ln -s "$tmpfile" "$lockf" 2>/dev/null; then + rm -f "$tmpfile" + havelock=true && return 0 + fi +@@ -432,6 +432,8 @@ findpids() { + esac ;; + GNU|gnu) + fp_psout=$(ps -g 2>/dev/null) ;; # GNU Hurd syntax ++ haiku) ++ fp_psout=$(ps 2>/dev/null) ;; # Haiku OS + esac + + # If we didn't get a match above, try a list of possibilities... +@@ -448,7 +450,7 @@ findpids() { + if [ -n "$fp_psout" ]; then + echo "$fp_psout" | \ + awk "BEGIN{IGNORECASE=1} /defunct/{next} +- /$fp_prog-[a]gen/{print \$1}" | xargs ++ /$fp_prog-[a]gen/{print \$2}" | xargs + return 0 + fi + +@@ -1091,8 +1093,8 @@ parse_mykeys() { + if wantagent ssh; then + if [ -f "$pm_k" ]; then + add_sshkey "$pm_k" ; continue +- elif [ -f "$HOME/.ssh/$pm_k" ]; then +- add_sshkey "$HOME/.ssh/$pm_k" ; continue ++ elif [ -f "$HOME/config/settings/ssh/$pm_k" ]; then ++ add_sshkey "$HOME/config/settings/ssh/$pm_k" ; continue + elif [ -f "$HOME/.ssh2/$pm_k" ]; then + add_sshkey "$HOME/.ssh2/$pm_k" ; continue + elif [ -f "$pkeypath" ]; then +@@ -1168,7 +1170,7 @@ confpath() { + break + fi + esac +- done < ~/.ssh/config ++ done < ~/config/settings/ssh/config + } + + # synopsis: wantagent prog +@@ -1314,11 +1316,11 @@ while [ -n "$1" ]; do + quietopt=true + ;; + --confhost|-c) +- if [ -e ~/.ssh/config ]; then ++ if [ -e ~/config/settings/ssh/config ]; then + sshconfig=true + confhost="$2" + else +- warn "~/.ssh/config not found; --confhost/-c option ignored." ++ warn "~/config/settings/ssh/config not found; --confhost/-c option ignored." + fi + ;; + --nocolor) +-- +2.23.0 +