From 8335eba18c69da5c72efb29d9295b52d4488aaeb Mon Sep 17 00:00:00 2001 From: zaphod-black Date: Sun, 2 Nov 2025 01:25:56 -0500 Subject: [PATCH] UX: Add system install to menu + prompt after initial setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made system-wide installation more discoverable and automatic. CHANGES: 1. Main Menu Option 7 Added: - New option: "Install as system command" - Renumbered Exit from 7 to 8 - Updated prompt from [1-7] to [1-8] - Calls install_script() directly from menu 2. Post-Installation Prompt: - After initial target configuration completes, asks: "Would you like to install PBSClientTool as a system command?" - Shows benefit: "This will allow you to run 'sudo PBSClientTool' from anywhere." - Default: yes (recommended) - Only prompts if not already installed (checks $INSTALL_PATH) - Applied to both setup paths: - PBS client already installed (first target setup) - PBS client not installed (fresh install) 3. Installation Detection: - Checks if /usr/local/bin/PBSClientTool already exists - Skips prompt if already installed - Prevents redundant installation offers USER EXPERIENCE: Before: - Users had to know about --install flag - Manual installation required navigating to script directory - No guidance after setup After: - Automatic prompt after initial setup (smart default) - Menu option for installation anytime - Clear explanation of benefits - One-time setup, use anywhere Example flow: 1. User runs: sudo ./pbs-client-installer.sh 2. Completes initial configuration wizard 3. Script shows: "First target 'default' created successfully!" 4. Script asks: "Install as system command? (yes/no) [yes]:" 5. User presses Enter (accepts default) 6. Installed to /usr/local/bin/PBSClientTool 7. User can now run: sudo PBSClientTool (from any directory) This makes system installation the default path for new users, improving discoverability and ease of use. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CHANGELOG.md | 3 +++ pbs-client-installer.sh | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 152cb4e..b1a4128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - install_script() function handles installation with overwrite confirmation - uninstall_script() function removes command but keeps configurations - Command-line argument parsing before main() execution + - **Menu option 7: "Install as system command"** - Available in main menu + - **Post-installation prompt** - Automatically asks if you want to install as system command after initial setup + - Detects if already installed (skips prompt if /usr/local/bin/PBSClientTool exists) - **Automatic connection testing at startup** - All configured targets are automatically tested when script starts - Quick authentication check (5 second timeout per target) diff --git a/pbs-client-installer.sh b/pbs-client-installer.sh index c83769b..4f96e8d 100755 --- a/pbs-client-installer.sh +++ b/pbs-client-installer.sh @@ -2161,8 +2161,9 @@ main() { echo " 4) Delete target" echo " 5) Run backup now (select target)" echo " 6) Reinstall PBS client" - echo " 7) Exit" - ACTION=$(prompt "Select option [1-7]" "7") + echo " 7) Install as system command" + echo " 8) Exit" + ACTION=$(prompt "Select option [1-8]" "8") case "$ACTION" in 1) @@ -2240,6 +2241,9 @@ main() { log "PBS client reinstalled successfully" ;; 7) + install_script + ;; + 8) info "Exiting" exit 0 ;; @@ -2271,6 +2275,22 @@ main() { echo log "First target '$TARGET_NAME' created successfully!" + echo + + # Offer to install as system command + if [ ! -f "$INSTALL_PATH" ]; then + echo + info "Would you like to install PBSClientTool as a system command?" + echo "This will allow you to run 'sudo PBSClientTool' from anywhere." + echo + INSTALL_CHOICE=$(prompt "Install as system command? (yes/no)" "yes") + + if [ "$INSTALL_CHOICE" = "yes" ]; then + echo + install_script + fi + fi + echo info "You can add more targets by running this script again." exit 0 @@ -2311,6 +2331,22 @@ main() { echo log "First target '$TARGET_NAME' created successfully!" + echo + + # Offer to install as system command + if [ ! -f "$INSTALL_PATH" ]; then + echo + info "Would you like to install PBSClientTool as a system command?" + echo "This will allow you to run 'sudo PBSClientTool' from anywhere." + echo + INSTALL_CHOICE=$(prompt "Install as system command? (yes/no)" "yes") + + if [ "$INSTALL_CHOICE" = "yes" ]; then + echo + install_script + fi + fi + echo info "You can add more targets by running this script again." exit 0