fix(install): default to /usr/local/bin (on PATH for all users)
Root or writable /usr/local/bin: install there (no PATH edits needed). Non-root without sudo: fall back to ~/.local/bin + auto-add to .bashrc. This eliminates the 'NOTE: not on your PATH' message for the common case.
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
d3e91c4b932a96a31d1ca1b805f24b42d23c6e26e63f2c28d7c7798321eb31fe orca-v0.12.18-linux-amd64.tar.gz
|
||||
1355da96421a15de6ec0d7ac0678f463762b8cad31133fb437243c6bda224b04 orca-v0.12.18-linux-amd64.tar.gz
|
||||
|
||||
+19
-2
@@ -69,6 +69,9 @@ if [ "$SYSTEM" = "true" ]; then
|
||||
fi
|
||||
INSTALL_BIN="/usr/local/bin/orca"
|
||||
NAMESPACE_DIR="/root/.orca"
|
||||
elif [ -w /usr/local/bin ] || [ "$(id -u)" -eq 0 ]; then
|
||||
INSTALL_BIN="/usr/local/bin/orca"
|
||||
NAMESPACE_DIR="${HOME}/.orca"
|
||||
else
|
||||
INSTALL_BIN="${HOME}/.local/bin/orca"
|
||||
NAMESPACE_DIR="${HOME}/.orca"
|
||||
@@ -259,9 +262,23 @@ if [ "$SYSTEM" = "true" ]; then
|
||||
info " namespace root: ${NAMESPACE_DIR} (use 'orca --system init' to initialize)"
|
||||
else
|
||||
info " namespace root: ${NAMESPACE_DIR} (use 'orca init' to initialize)"
|
||||
# If the install dir is not on PATH, add it to .bashrc automatically.
|
||||
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
|
||||
info " NOTE: $INSTALL_DIR is not on your PATH. Add it:"
|
||||
info " export PATH=\"\$PATH:$INSTALL_DIR\""
|
||||
info " Adding $INSTALL_DIR to PATH via ~/.bashrc..."
|
||||
SHELL_RC="${HOME}/.bashrc"
|
||||
if [ -f "$SHELL_RC" ]; then
|
||||
# Append only if not already present (idempotent).
|
||||
if ! grep -qF "$INSTALL_DIR" "$SHELL_RC"; then
|
||||
echo "" >> "$SHELL_RC"
|
||||
echo "# Added by orca install.sh" >> "$SHELL_RC"
|
||||
echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$SHELL_RC"
|
||||
info " ✓ Added 'export PATH=\"\$PATH:$INSTALL_DIR\"' to ~/.bashrc"
|
||||
info " Run 'source ~/.bashrc' or start a new shell to pick up the change."
|
||||
fi
|
||||
else
|
||||
info " NOTE: ~/.bashrc not found. Add to PATH manually:"
|
||||
info " export PATH=\"\$PATH:$INSTALL_DIR\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user