install script update
This commit is contained in:
18
install.sh
18
install.sh
@@ -84,34 +84,28 @@ ok "Installed → $INSTALL_DIR/$BINARY"
|
|||||||
|
|
||||||
# ── Add ~/.local/bin to PATH if missing ──────────────────────────────────────
|
# ── Add ~/.local/bin to PATH if missing ──────────────────────────────────────
|
||||||
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
|
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
|
||||||
warn "$INSTALL_DIR is not in PATH — adding it now..."
|
export PATH="$INSTALL_DIR:$PATH"
|
||||||
|
|
||||||
EXPORT_LINE="export PATH=\"\$HOME/.local/bin:\$PATH\""
|
EXPORT_LINE="export PATH=\"\$HOME/.local/bin:\$PATH\""
|
||||||
|
|
||||||
# Determine which profile file to update
|
if [ -f "$HOME/.zshrc" ]; then
|
||||||
if [ -f "$HOME/.bashrc" ]; then
|
PROFILE="$HOME/.zshrc"
|
||||||
|
elif [ -f "$HOME/.bashrc" ]; then
|
||||||
PROFILE="$HOME/.bashrc"
|
PROFILE="$HOME/.bashrc"
|
||||||
elif [ -f "$HOME/.bash_profile" ]; then
|
elif [ -f "$HOME/.bash_profile" ]; then
|
||||||
PROFILE="$HOME/.bash_profile"
|
PROFILE="$HOME/.bash_profile"
|
||||||
elif [ -f "$HOME/.profile" ]; then
|
elif [ -f "$HOME/.profile" ]; then
|
||||||
PROFILE="$HOME/.profile"
|
PROFILE="$HOME/.profile"
|
||||||
else
|
else
|
||||||
# Create .bashrc if nothing exists
|
|
||||||
PROFILE="$HOME/.bashrc"
|
PROFILE="$HOME/.bashrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Avoid duplicate entries
|
|
||||||
if ! grep -qF "$INSTALL_DIR" "$PROFILE" 2>/dev/null; then
|
if ! grep -qF "$INSTALL_DIR" "$PROFILE" 2>/dev/null; then
|
||||||
printf '\n# Added by ostiary installer\n%s\n' "$EXPORT_LINE" >> "$PROFILE"
|
printf '\n# Added by ostiary installer\n%s\n' "$EXPORT_LINE" >> "$PROFILE"
|
||||||
ok "Added PATH entry to $PROFILE"
|
ok "Added PATH entry to $PROFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
warn "Run the following to use ostiary in this session:"
|
|
||||||
warn " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
||||||
warn "New shells will pick it up automatically."
|
|
||||||
else
|
|
||||||
ok "$INSTALL_DIR is already in PATH"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
ok "Done! Run: $BINARY"
|
ok "Launching ${BINARY}..."
|
||||||
|
exec "$INSTALL_DIR/$BINARY"
|
||||||
|
|||||||
Reference in New Issue
Block a user