fix: improve RNS installation verification for user-local pip installs

When pip installs RNS to ~/.local/bin (user installation), the rnsd
command is not immediately available in PATH, causing the installer
to incorrectly report "Reticulum installation failed" even though
installation succeeded.

Changes:
- Add ~/.local/bin to PATH at the start of Reticulum check
- Add ~/.local/bin to PATH after pip install rns
- Check multiple locations for rnsd command:
  1. In PATH (command -v rnsd)
  2. In ~/.local/bin directly
  3. As Python package (python3 -c "import RNS")
- Make rnsd executable if found in ~/.local/bin
- Add PATH configuration instructions in final setup steps
- Dynamic step numbering based on whether PATH note is needed

This fixes false installation failures on Raspberry Pi OS and other
systems where pip defaults to user-local installation.

Tested on: Raspberry Pi Zero 2 W with Raspberry Pi OS Lite 64-bit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
torlando-tech 2025-10-28 23:38:27 -04:00
commit fae8a5c815

View file

@ -158,6 +158,11 @@ RNS_VENV=""
RNS_PYTHON=""
INSTALL_MODE=""
# Add user's local bin to PATH if it exists (common pip install location)
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Check if rnsd is available
if command -v rnsd &> /dev/null; then
print_success "Found rnsd command"
@ -197,16 +202,33 @@ else
# Install Reticulum using our pip helper function
pip_install rns
# Verify installation
# Add user's local bin to PATH (pip may install there)
export PATH="$HOME/.local/bin:$PATH"
# Verify installation (check multiple locations and Python import)
if command -v rnsd &> /dev/null; then
print_success "Reticulum installed successfully"
INSTALL_MODE="system"
RNS_PYTHON="python3"
elif [ -f "$HOME/.local/bin/rnsd" ]; then
print_success "Reticulum installed successfully (user installation)"
print_info "rnsd location: $HOME/.local/bin/rnsd"
INSTALL_MODE="system"
RNS_PYTHON="python3"
# Ensure it's executable
chmod +x "$HOME/.local/bin/rnsd" 2>/dev/null || true
elif python3 -c "import RNS" 2>/dev/null; then
print_warning "Reticulum Python package installed, but rnsd command not found in PATH"
print_info "You may need to add ~/.local/bin to your PATH"
echo " Add to ~/.bashrc: export PATH=\"\$HOME/.local/bin:\$PATH\""
INSTALL_MODE="system"
RNS_PYTHON="python3"
else
print_error "Reticulum installation failed"
echo
echo "Please try installing manually:"
echo " pip install rns"
echo " # Then add to PATH: export PATH=\"\$HOME/.local/bin:\$PATH\""
echo "Or visit: https://reticulum.network"
exit 1
fi
@ -514,14 +536,26 @@ echo " └──────────────────────
echo
echo "2. See examples/config_example.toml for all configuration options"
echo
echo "3. Start Reticulum:"
# Add PATH note if rnsd is in user's local bin
STEP_NUM=3
if [ -f "$HOME/.local/bin/rnsd" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo "3. Add ~/.local/bin to your PATH (for rnsd command):"
echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.bashrc"
echo " source ~/.bashrc"
echo
STEP_NUM=4
fi
echo "$STEP_NUM. Start Reticulum:"
if [ -n "$CUSTOM_CONFIG_DIR" ]; then
echo " rnsd --config $CONFIG_DIR --verbose"
else
echo " rnsd --verbose"
fi
echo
echo "4. Verify the interface is running:"
STEP_NUM=$((STEP_NUM + 1))
echo "$STEP_NUM. Verify the interface is running:"
echo " rnstatus"
echo