Skip to content

Commit 5327bcb

Browse files
committed
Make install.sh non-blocking if sudo password prompt fails and enhance install-cli.sh binary checks
1 parent c6a5e3f commit 5327bcb

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

.agents/skills/library-insight/scripts/install-cli.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# Check if library-insight is already available
3-
if command -v library-insight &> /dev/null; then
4-
echo "library-insight is already installed and available on PATH."
3+
if command -v library-insight &> /dev/null || [ -x "$HOME/.library-insight/bin/library-insight" ]; then
4+
echo "library-insight is already installed and ready to use."
55
exit 0
66
fi
77

install.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,27 @@ echo "Configuring executable permissions..."
5757
chmod +x "$INSTALL_DIR/bin/library-insight"
5858

5959
echo "Creating global symlink..."
60+
SYMLINK_SUCCESS=false
6061
if [ -d "/usr/local/bin" ]; then
61-
echo "Creating symlink in /usr/local/bin/library-insight (may request password for sudo)..."
62-
sudo ln -sf "$INSTALL_DIR/bin/library-insight" /usr/local/bin/library-insight
62+
if [ -w "/usr/local/bin" ]; then
63+
ln -sf "$INSTALL_DIR/bin/library-insight" /usr/local/bin/library-insight 2>/dev/null && SYMLINK_SUCCESS=true
64+
else
65+
sudo -n ln -sf "$INSTALL_DIR/bin/library-insight" /usr/local/bin/library-insight 2>/dev/null && SYMLINK_SUCCESS=true || sudo ln -sf "$INSTALL_DIR/bin/library-insight" /usr/local/bin/library-insight 2>/dev/null && SYMLINK_SUCCESS=true || true
66+
fi
67+
fi
68+
69+
if [ "$SYMLINK_SUCCESS" = true ]; then
6370
echo "=================================================="
6471
echo " SUCCESS: Library Insight installed globally!"
6572
echo " You can now run the 'library-insight' command."
6673
echo "=================================================="
6774
else
68-
echo "WARNING: /usr/local/bin does not exist on your system."
69-
echo "Please add the following to your shell configuration (.zshrc or .bashrc):"
70-
echo " export PATH=\"\$PATH:$INSTALL_DIR/bin\""
75+
echo "=================================================="
76+
echo " SUCCESS: Library Insight installed at $INSTALL_DIR/bin/library-insight!"
77+
echo " Direct path: $HOME/.library-insight/bin/library-insight"
78+
echo " To run directly without full path, add this to your .zshrc / .bashrc:"
79+
echo " export PATH=\"\$PATH:$INSTALL_DIR/bin\""
80+
echo "=================================================="
7181
fi
7282

7383
echo ""

library-insight-cli/src/main/resources/scripts/install-cli.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# Check if library-insight is already available
3-
if command -v library-insight &> /dev/null; then
4-
echo "library-insight is already installed and available on PATH."
3+
if command -v library-insight &> /dev/null || [ -x "$HOME/.library-insight/bin/library-insight" ]; then
4+
echo "library-insight is already installed and ready to use."
55
exit 0
66
fi
77

0 commit comments

Comments
 (0)