diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 8d7fbd9..db6d14e 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -103,9 +103,12 @@ PY echo "Found the following potentially interfering .pth files:" >&2 for p in "${pths[@]}"; do echo " - $p" >&2; done - if [[ "$REMOVE_PTH" == "true" ]]; then - echo "Removing .pth files as requested..." >&2 - for p in "${pths[@]}"; do rm -f "$p"; done + if [[ "$REMOVE_PTH" == "true" || "$FIX_URLLIB3" == "true" ]]; then + echo "Removing .pth files (automatic removal due to --fix-urllib3)..." >&2 + for p in "${pths[@]}"; do + rm -f "$p" + echo "Removed: $p" >&2 + done else if [[ "$QUIET" == "true" ]]; then echo "Detected interfering .pth files but cannot prompt in quiet mode. Re-run with --remove-pth to remove them automatically." >&2 @@ -116,7 +119,10 @@ PY echo "User declined to remove .pth files. Aborting." >&2 return 3 fi - for p in "${pths[@]}"; do rm -f "$p"; done + for p in "${pths[@]}"; do + rm -f "$p" + echo "Removed: $p" >&2 + done fi # Re-run reinstall & verify @@ -396,6 +402,10 @@ fi SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO="$(cd "$SCRIPT_DIR/.." && pwd)" USER_BIN="${XDG_BIN_HOME:-$HOME/.local/bin}" +# If running as root, prefer a system-wide location that is likely on PATH (/usr/local/bin) +if [[ $(id -u) -eq 0 && -w "/usr/local/bin" ]]; then + USER_BIN="/usr/local/bin" +fi mkdir -p "$USER_BIN" if [[ -f "$USER_BIN/mm" ]]; then echo "Backing up existing $USER_BIN/mm to $USER_BIN/mm.bak.$(date +%s)" @@ -419,7 +429,7 @@ chmod +x "$USER_BIN/mm" if "$USER_BIN/mm" --help >/dev/null 2>&1; then echo "Global 'mm' launcher verified: $USER_BIN/mm runs correctly." else - echo "Warning: Global 'mm' launcher failed to run in this shell. Ensure $USER_BIN is on your PATH and the venv is installed; try: $VENV/bin/python -m medeia_macina.cli_entry --help" >&2 + echo "Warning: Global 'mm' launcher failed to run in this shell. Ensure $USER_BIN is on your PATH and the venv is installed; try: $VENV_PY -m medeia_macina.cli_entry --help" >&2 fi # Ensure the user's bin is on PATH for future sessions by adding to ~/.profile if needed