From fb43df06f41dd26e709bcab27958296369ff1bdd Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Mon, 7 Aug 2023 15:48:33 +0800 Subject: [PATCH] sagt: import ssh-agent -P paths --- tools/sagent.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/sagent.sh b/tools/sagent.sh index 1ead9e2..8f2545f 100755 --- a/tools/sagent.sh +++ b/tools/sagent.sh @@ -5,10 +5,14 @@ export DFS_COLOR=1 source "$THIS_DIR/common.sh" +SO_PATHS=( + "/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so" # ubuntu 22.04 + "/run/current-system/sw/lib/opensc-pkcs11.so" # nixos 23.05 + "/Library/OpenSC/lib/opensc-pkcs11.so" # macos 13.4 +) + find_so_file() { - # they are: ubuntu 22.04, nixos 23.05, macos 13.4 - local SO_PATHS=( "/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so" "/run/current-system/sw/lib/opensc-pkcs11.so" "/Library/OpenSC/lib/opensc-pkcs11.so" ) local SO_FILE for SO_FILE in ${SO_PATHS[*]}; do if [[ -f "$SO_FILE" ]]; then @@ -20,7 +24,8 @@ find_so_file() create_agent() { - ssh-agent -P "/usr/lib/*,/nix/store/*,/Library/*" + local IFS="," + ssh-agent -P "${SO_PATHS[*]}" } kill_agent()