From 4b7a255950ec257987aed11d48411a3244c95b2a Mon Sep 17 00:00:00 2001 From: torlando-tech Date: Tue, 28 Oct 2025 19:34:40 -0400 Subject: [PATCH] feat: add --config flag to install.sh for custom config directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The install.sh script now supports an optional --config flag to specify a custom Reticulum config directory during installation. Changes: - Add command-line argument parsing for --config flag - Add --help flag to display usage information - Update installation path logic to use custom or default directory - Update final instructions to show correct rnsd command with --config flag - Document the new --config flag in README.md Usage: ./install.sh # Install to ~/.reticulum (default) ./install.sh --config /custom/path # Install to custom directory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 5 ++++- install.sh | 45 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f0ec29f..27abbfe 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,16 @@ git clone https://github.com/torlando-tech/ble-reticulum.git cd ble-reticulum chmod +x install.sh ./install.sh + +# For custom config directory: +# ./install.sh --config /path/to/custom/config ``` The script will: 1. ✓ Detect if Reticulum is in a venv or system-wide 2. ✓ Install system dependencies (BlueZ, dbus) 3. ✓ Install Python packages in the correct environment -4. ✓ Copy BLE interface files to `~/.reticulum/interfaces/` +4. ✓ Copy BLE interface files to `~/.reticulum/interfaces/` (or custom config directory if specified) 5. ✓ Optionally set up Bluetooth permissions ### Option B: Manual Installation diff --git a/install.sh b/install.sh index 82d5c8f..3e3dece 100755 --- a/install.sh +++ b/install.sh @@ -34,6 +34,31 @@ print_info() { echo -e "${BLUE}ℹ${NC} $1" } +# Parse command line arguments +CUSTOM_CONFIG_DIR="" +while [[ $# -gt 0 ]]; do + case $1 in + --config) + CUSTOM_CONFIG_DIR="$2" + shift 2 + ;; + -h|--help) + echo "Usage: $0 [--config CONFIG_DIR]" + echo "" + echo "Options:" + echo " --config CONFIG_DIR Install to custom Reticulum config directory" + echo " (default: ~/.reticulum)" + echo " -h, --help Show this help message" + exit 0 + ;; + *) + echo "Unknown option: $1" + echo "Use --help for usage information" + exit 1 + ;; + esac +done + # Check if running on Linux if [[ "$OSTYPE" != "linux-gnu"* ]]; then print_error "This interface only works on Linux (requires BlueZ)" @@ -159,7 +184,17 @@ echo print_header "Installing BLE Interface Files" # Determine where to copy files -INTERFACES_DIR="$HOME/.reticulum/interfaces" +if [ -n "$CUSTOM_CONFIG_DIR" ]; then + # Use custom config directory if specified + CONFIG_DIR="$CUSTOM_CONFIG_DIR" + print_info "Using custom config directory: $CONFIG_DIR" +else + # Default to ~/.reticulum + CONFIG_DIR="$HOME/.reticulum" + print_info "Using default config directory: $CONFIG_DIR" +fi + +INTERFACES_DIR="$CONFIG_DIR/interfaces" # Create directory if it doesn't exist mkdir -p "$INTERFACES_DIR" @@ -209,7 +244,7 @@ echo # Step 6: Configuration print_header "Configuration" -CONFIG_FILE="$HOME/.reticulum/config" +CONFIG_FILE="$CONFIG_DIR/config" print_info "Next steps:" echo @@ -230,7 +265,11 @@ echo echo "2. See examples/config_example.toml for all configuration options" echo echo "3. Start Reticulum:" -echo " rnsd --verbose" +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:" echo " rnstatus"