From: Alexander Barton Date: Fri, 29 Mar 2024 19:10:15 +0000 (+0100) Subject: sd-tool: Enhance detection of "share" folder X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=d0979b21f9885ae288931d65e1c61bc5832b26d4;p=sd-tool.git sd-tool: Enhance detection of "share" folder No longer look in default locations (to not mix versions) and variable directories (".", "..") to not inject foreign/malicious code, but try to get the correct path name from the path of the sd-tool script. --- diff --git a/bin/sd-tool b/bin/sd-tool index d98a72e..550e8d8 100755 --- a/bin/sd-tool +++ b/bin/sd-tool @@ -9,9 +9,11 @@ # (at your option) any later version. # +BIN_D=$(dirname "$0") + # Detect our "share" folder ... unset SHARE_D -for d in . .. /usr/local /usr; do +for d in "${BIN_D}" "${BIN_D}"/..; do for s in share share/sd-tool; do if [[ -r "${d}/${s}/sd-tool-common.inc.sh" ]]; then SHARE_D="${d}/${s}"