diff options
author | Leah Rowe <leah@libreboot.org> | 2025-05-07 19:00:13 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-05-07 19:00:13 +0100 |
commit | cba04aa74b816cbd5f1266a73962f6dd48ee2892 (patch) | |
tree | 51e07a1d59a432fa9486ea05878393d43e419eb8 /include/lib.sh | |
parent | a94bd3c0939fac05a902af2cce2cf862ecdf9200 (diff) |
init.sh: Use readlink in pybin()
Use realpath only as a fallback.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r-- | include/lib.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/lib.sh b/include/lib.sh index 950a07c8..99e59a1a 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -144,6 +144,18 @@ singletree() return 1 } +findpath() +{ + [ $# -gt 0 ] || err "findpath: No arguments provided" + while [ $# -gt 0 ]; do + found="`readlink -f "$1" 2>/dev/null`" || return 1; : + [ -n "$found" ] || found="`realpath "$1" 2>/dev/null`" || \ + return 1; : + printf "%s\n" "$found" + shift 1 + done +} + fx_() { fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" |