#!/bin/bash SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "$SCRIPT_DIR/lib/common-functions.sh" if [ "$EUID" -ne 0 ]; then print_error "This script must be run as root" exit 1 fi print_banner "Update Acronis Agent" echo "" echo -e "${BOLD}Acronis Agent Update${NC}" echo "" # Check current version echo "→ Checking current agent version..." if [ -f "/usr/lib/Acronis/BackupAndRecovery/aakore" ]; then current_version=$(/usr/lib/Acronis/BackupAndRecovery/aakore --version 2>/dev/null | head -1 || echo "Unknown") echo " Current version: ${current_version}" else print_error "Acronis agent not found" press_enter exit 1 fi echo "" echo -e "${BOLD}Update Methods:${NC}" echo "" echo -e "${CYAN}1. Automatic Update (via Acronis Cloud)${NC}" echo " • Managed from web console" echo " • Navigate to: Settings → Agent updates" echo " • Enable automatic updates or schedule manually" echo "" echo -e "${CYAN}2. Manual Update (Download + Install)${NC}" echo " • Download latest agent installer" echo " • Install over existing agent" echo " • Preserves configuration and registration" echo "" echo -n "Select update method (1/2) or 0 to cancel [1]: " read -r method method="${method:-1}" case "$method" in 1) echo "" echo "Automatic updates are managed through Acronis Cloud." echo "" echo "To enable:" echo " 1. Log in to Acronis web console" echo " 2. Go to: Settings → Agent updates" echo " 3. Configure update policy for this agent" echo "" ;; 2) echo "" echo "Manual update will download and install the latest agent." echo "" echo -n "Proceed with manual update? (yes/no): " read -r confirm if [ "$confirm" = "yes" ]; then echo "" echo "→ This will run the installer in upgrade mode..." echo "" echo "Note: You can use the 'Install Acronis Agent' option" echo "which will detect existing installation and offer upgrade." echo "" fi ;; *) echo "" echo "Update cancelled" ;; esac echo "" press_enter