mirror of
https://github.com/token2/fido2-manage.git
synced 2026-07-01 08:16:53 +00:00
Fix hardcoded FIDO2_TOKEN_CMD path in fido2-manage.sh
Replaces the hardcoded /usr/local/bin/fido2-token2 with dynamic detection: checks alongside the script first (dev builds), then falls back to PATH so any install prefix works correctly. Fixes #32
This commit is contained in:
@@ -1,6 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
FIDO2_TOKEN_CMD="/usr/local/bin/fido2-token2"
|
# Locate fido2-token2: check next to this script first (dev builds),
|
||||||
|
# then fall back to PATH (handles any install prefix).
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
FIDO2_TOKEN_CMD=""
|
||||||
|
for candidate in \
|
||||||
|
"$SCRIPT_DIR/fido2-token2" \
|
||||||
|
"$SCRIPT_DIR/build/tools/fido2-token2" \
|
||||||
|
"$SCRIPT_DIR/tools/fido2-token2"
|
||||||
|
do
|
||||||
|
if [[ -f "$candidate" ]]; then
|
||||||
|
FIDO2_TOKEN_CMD="$candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$FIDO2_TOKEN_CMD" ]]; then
|
||||||
|
FIDO2_TOKEN_CMD="$(command -v fido2-token2 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
|
||||||
list=false
|
list=false
|
||||||
info=false
|
info=false
|
||||||
@@ -110,6 +128,11 @@ if ! $list && ! $info && [[ -z $device ]] && ! $fingerprint && ! $storage && ! $
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$FIDO2_TOKEN_CMD" ]]; then
|
||||||
|
show_message "fido2-token2 not found. Install it or ensure it is on your PATH." "Error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if $list; then
|
if $list; then
|
||||||
command_output=$($FIDO2_TOKEN_CMD -L 2>&1)
|
command_output=$($FIDO2_TOKEN_CMD -L 2>&1)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user