pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/security/keychain
Module Name: pkgsrc
Committed By: vins
Date: Sat Nov 8 16:55:52 UTC 2025
Modified Files:
pkgsrc/security/keychain: Makefile
pkgsrc/security/keychain/files: startkeychain.sh
Log Message:
security/keychain: startkeychain: simplify and speed up script
Bump revision.
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 pkgsrc/security/keychain/Makefile
cvs rdiff -u -r1.3 -r1.4 pkgsrc/security/keychain/files/startkeychain.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/security/keychain/Makefile
diff -u pkgsrc/security/keychain/Makefile:1.47 pkgsrc/security/keychain/Makefile:1.48
--- pkgsrc/security/keychain/Makefile:1.47 Sat Nov 8 12:36:13 2025
+++ pkgsrc/security/keychain/Makefile Sat Nov 8 16:55:52 2025
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.47 2025/11/08 12:36:13 vins Exp $
+# $NetBSD: Makefile,v 1.48 2025/11/08 16:55:52 vins Exp $
DISTNAME= keychain-2.9.8
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_GITHUB:=funtoo/}
Index: pkgsrc/security/keychain/files/startkeychain.sh
diff -u pkgsrc/security/keychain/files/startkeychain.sh:1.3 pkgsrc/security/keychain/files/startkeychain.sh:1.4
--- pkgsrc/security/keychain/files/startkeychain.sh:1.3 Sat Nov 8 15:55:48 2025
+++ pkgsrc/security/keychain/files/startkeychain.sh Sat Nov 8 16:55:52 2025
@@ -2,58 +2,48 @@
[ -n "$HOME" ] || HOME=$(getent passwd "$USER" | cut -d: -f6)
+[ -n "$HOSTNAME" ] || HOSTNAME=$(uname -n)
+
# Load user settings, if found.
[ -f "$HOME/.keychainrc" ] && . $HOME/.keychainrc
-# If SSHKEYS is unset, search for private keys inside the ~/.ssh directory
+# If SSHKEYS is unset, search for private keys inside the ~/.ssh directory.
[ -n "$SSHKEYS" ] || SSHKEYS=$(find ${HOME}/.ssh ! -name *pub \
-exec grep -l -e '[DRS]S[AH] PRIVATE KEY' {} \; | tr '\n' ' ')
# If unset, keep GPGKEYS empty.
[ -n "$GPGKEYS" ] || GPGKEYS=""
-# Allow to pass a number of keychain options as first argument.
+# Allow to pass some keychain options as argument.
# Silence output by default, to allow this to be sourced in login scripts.
-
[ -n "$KCHOPTS" ] || KCHOPTS="--quiet"
case $1 in
-c) KCHOPTS="$KCHOPTS --clear" ;;
-e) KCHOPTS="$KCHOPTS --eval" ;;
-f) KCHOPTS="$KCHOPTS --ssh-allow-forwarded" ;;
-h) echo "usage: keychain [-fcq]"
- exit 0 ;;
+ exit 0 ;;
-*|--*)
- echo "Unknown option $1"
- exit 2 ;;
+ echo "Unknown option $1"
+ exit 2 ;;
esac
-host=$(uname -n)
-ssh_env="${HOME}/.keychain/${host}-sh"
-gpg_env="${HOME}/.keychain/${host}-sh-gpg"
-
-# Test for SSHKEYS first. If empty, try GPGKEYS as fallback.
-if [ -z "$SSHKEYS" ]; then
- printf '%s\n' "warning: no private keys found in $HOME/.ssh."
- if [ -n "$GPGKEYS" ]; then
- printf '%s\n' "Loading gpg key(s)"
- keychain $KCHOPTS $GPGKEYS
- [ -f "$gpg_env" ] && . $gpg_env
- else
- # Error out if no loadable keys were specified.
- printf '%s\n' "warning: empty gpg keys list." \
- "Use the SSHKEYS and GPGKEYS envinromental variables to specify one or more key to load."
- exit 1
- fi
+ssh_env="${HOME}/.keychain/${HOSTNAME}-sh"
+gpg_env="${HOME}/.keychain/${HOSTNAME}-sh-gpg"
+
+[ -n "$SSHKEYS" ] || printf '%s\n' "warning: no private keys found in $HOME/.ssh."
+
+if [ -z "$SSHKEYS" ] && [ -z "$GPGKEYS" ]; then
+ # Error out if no loadable keys were specified.
+ printf '%s\n' "error: no key id provided" \
+ "Use the SSHKEYS and GPGKEYS envinromental variables to specify one or more key to load."
+ exit 1
else
-# Otherwise load both SSHKEYS and GPGKEYS (allow the latter to be empty).
+ # Otherwise load both SSHKEYS and GPGKEYS
keychain $KCHOPTS $SSHKEYS $GPGKEYS
- for file in $ssh_env $gpg_env; do
- if [ -f "$file" ]; then
- . $file
- else
- printf '%s\n' "warning: $file not found"
- fi
+ for file in "$ssh_env" "$gpg_env"; do
+ [ -f "$file" ] && . $file
done
fi
-unset KCHOPTS SSHKEYS GPGKEYS host
+unset KCHOPTS SSHKEYS GPGKEYS
Home |
Main Index |
Thread Index |
Old Index