From 95f92533021d01eafe923cd03980dd4fbb821cca Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 5 Nov 2025 21:39:57 -0500 Subject: [PATCH] Enhance Acronis installer with advanced/custom mode and better token handling Added option 5 "Advanced/Custom installation" to installer with: Interactive Option Builder: - Unattended mode toggle (auto-accept prompts) - Registration options: * Register with token during install * Skip registration (register later) * Interactive (let installer prompt) - Verbose logging flag - Custom flags input for any additional options (proxy, language, bandwidth throttling, etc.) Improved Token Input: - Better instructions for obtaining token from web console - Automatic whitespace/linebreak removal for pasted tokens - Works with copy-paste from web console - Handles multi-line paste gracefully Enhanced Service URL Selection: - Shows common regions with examples: * us5-cloud.acronis.com (US) * eu2-cloud.acronis.com (Europe) * ap1-cloud.acronis.com (Asia Pacific) * ca1-cloud.acronis.com (Canada) - Only prompts for URL when registration is enabled Installation Modes Now Available: 1. Interactive installation - guided with prompts 2. Unattended installation - auto-accepts all 3. Install and register with token - one-step setup 4. Install without registration - defer registration 5. Advanced/Custom - build custom flag combination Example Advanced Mode Usage: - Select unattended: y - Registration: option 1 (with token) - Paste token: [automatically strips spaces] - Verbose logging: y - Custom flags: --proxy=http://proxy:8080 All flags are shown in summary before installation proceeds. --- modules/backup/acronis-install.sh | 103 ++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 5 deletions(-) diff --git a/modules/backup/acronis-install.sh b/modules/backup/acronis-install.sh index d7448b9..cd4f581 100755 --- a/modules/backup/acronis-install.sh +++ b/modules/backup/acronis-install.sh @@ -51,6 +51,7 @@ echo " 1) Interactive installation (default)" echo " 2) Unattended installation (auto-accept)" echo " 3) Install and register with token" echo " 4) Install without registration" +echo " 5) Advanced/Custom installation (specify all flags)" echo "" echo -n "Select installation mode [1]: " read -r install_mode @@ -70,8 +71,20 @@ case "$install_mode" in 3) INSTALL_FLAGS="-a" echo "" - echo -n "Enter registration token: " + echo -e "${BOLD}Register During Installation${NC}" + echo "" + echo "Paste your Acronis registration token below." + echo "To get a token:" + echo " 1. Log in to Acronis web console" + echo " 2. Go to: Settings → Registration tokens" + echo " 3. Create token or copy existing one" + echo "" + echo -n "Registration token: " read -r REGISTRATION_TOKEN + + # Allow pasting multi-line or trimming whitespace + REGISTRATION_TOKEN=$(echo "$REGISTRATION_TOKEN" | tr -d '[:space:]') + if [ -z "$REGISTRATION_TOKEN" ]; then print_error "Token is required for this mode" press_enter @@ -86,22 +99,102 @@ case "$install_mode" in echo "" echo "Mode: Install without registration" ;; + 5) + # Advanced/Custom mode + echo "" + echo -e "${BOLD}Advanced Installation${NC}" + echo "" + echo "Build custom installation flags by selecting options." + echo "" + + # Unattended mode + echo -n "Unattended install (auto-accept)? (y/n) [y]: " + read -r use_unattended + use_unattended="${use_unattended:-y}" + if [ "$use_unattended" = "y" ]; then + INSTALL_FLAGS="$INSTALL_FLAGS -a" + fi + + # Registration options + echo "" + echo "Registration:" + echo " 1) Register with token during install" + echo " 2) Skip registration (register later)" + echo " 3) Interactive (installer will prompt)" + echo -n "Select [3]: " + read -r reg_choice + reg_choice="${reg_choice:-3}" + + if [ "$reg_choice" = "1" ]; then + echo "" + echo "Paste your Acronis registration token:" + echo "(Spaces and line breaks will be automatically removed)" + echo "" + read -r REGISTRATION_TOKEN + REGISTRATION_TOKEN=$(echo "$REGISTRATION_TOKEN" | tr -d '[:space:]') + + if [ -n "$REGISTRATION_TOKEN" ]; then + INSTALL_FLAGS="$INSTALL_FLAGS --token=$REGISTRATION_TOKEN" + else + print_error "Token cannot be empty" + press_enter + exit 1 + fi + elif [ "$reg_choice" = "2" ]; then + INSTALL_FLAGS="$INSTALL_FLAGS --skip-registration" + fi + + # Additional flags + echo "" + echo -e "${BOLD}Additional Options:${NC}" + echo "" + + # Verbose logging + echo -n "Enable verbose logging? (y/n) [n]: " + read -r use_verbose + if [ "$use_verbose" = "y" ]; then + INSTALL_FLAGS="$INSTALL_FLAGS --verbose" + fi + + # Custom flags + echo "" + echo "Enter any additional custom flags (or press Enter to skip):" + echo "Examples: --proxy=http://proxy:8080, --language=en, etc." + echo "" + echo -n "Custom flags: " + read -r custom_flags + if [ -n "$custom_flags" ]; then + INSTALL_FLAGS="$INSTALL_FLAGS $custom_flags" + fi + + echo "" + echo "Mode: Advanced/Custom installation" + ;; *) echo "" echo "Mode: Interactive installation" ;; esac -# Ask for service URL if not using token -if [ "$install_mode" != "4" ]; then +# Ask for service URL (for all modes except skip-registration) +if [[ "$INSTALL_FLAGS" != *"--skip-registration"* ]]; then echo "" - echo -n "Acronis Cloud region [us5-cloud.acronis.com]: " + echo -e "${BOLD}Acronis Cloud Region${NC}" + echo "" + echo "Common regions:" + echo " • us5-cloud.acronis.com (US - Default)" + echo " • eu2-cloud.acronis.com (Europe)" + echo " • ap1-cloud.acronis.com (Asia Pacific)" + echo " • ca1-cloud.acronis.com (Canada)" + echo "" + echo -n "Enter service URL [us5-cloud.acronis.com]: " read -r input_url if [ -n "$input_url" ]; then SERVICE_URL="$input_url" fi - if [ "$install_mode" = "3" ]; then + # Add --rain flag if token is being used + if [[ "$INSTALL_FLAGS" == *"--token"* ]]; then INSTALL_FLAGS="$INSTALL_FLAGS --rain=$SERVICE_URL" fi fi