From da9adc0988c1f6b05bdefd650db7e36412df52cf Mon Sep 17 00:00:00 2001 From: Claudio Alessi Date: Mon, 19 Jan 2026 16:34:32 +0100 Subject: [PATCH] Honor prefix if specified and ensure paths exists. --- get.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/get.sh b/get.sh index 2df5087..f113c0f 100755 --- a/get.sh +++ b/get.sh @@ -24,23 +24,21 @@ install_filemanager() { trap 'echo -e "Aborted, error $? in command: $BASH_COMMAND"; trap ERR; return 1' ERR - filemanager_os="unsupported" - filemanager_arch="unknown" - install_path="/usr/local/bin" - # Termux on Android has $PREFIX set which already ends with /usr - if [[ -n "$ANDROID_ROOT" && -n "$PREFIX" ]]; then - install_path="$PREFIX/bin" - fi + # defaults to /usr/local + [[ -z "$PREFIX" ]] && PREFIX="/usr/local" - # Fall back to /usr/bin if necessary - if [[ ! -d $install_path ]]; then - install_path="/usr/bin" - fi + filemanager_os="unsupported" + filemanager_arch="unknown" + install_path="$PREFIX/bin" # Not every platform has or needs sudo (https://termux.com/linux.html) ((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo" + # ensure directories exists + [[ ! -d "$PREFIX" ]] && mkdir -p "$PREFIX" + [[ ! -d "$install_path" ]] && mkdir -p "$install_path" + ######################### # Which OS and version? # #########################