Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,13 @@ echo "✅ Extraction completed"
sudo_if_install_dir_not_writeable() {
local command="$1"
local exit_code
if [ -w "$INSTALL_DIR" ]; then
# Directory is writable, run without sudo
local check_dir="$INSTALL_DIR"
# Walk up to find the first existing ancestor to check writability
while [ -n "$check_dir" ] && [ "$check_dir" != "/" ] && [ ! -e "$check_dir" ]; do
check_dir="$(dirname "$check_dir")"
done
if [ -w "$check_dir" ]; then
# Directory (or its ancestor) is writable, run without sudo
sh -c "$command"
else
# Directory requires elevated privileges
Expand Down
Loading