Trigger wizard when either remote or target is missing
- Changed condition from AND to OR: wizard runs if remotes OR targets are not configured (not only when both are empty) - Wizard skips steps that are already done (e.g. if remote exists, jumps straight to target creation) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -439,7 +439,7 @@ elif [[ "$FORCE_CLI" == "true" ]]; then
|
|||||||
elif command -v gum &>/dev/null && [[ -t 1 ]]; then
|
elif command -v gum &>/dev/null && [[ -t 1 ]]; then
|
||||||
# TUI mode
|
# TUI mode
|
||||||
show_logo
|
show_logo
|
||||||
if ! has_remotes && ! has_targets; then
|
if ! has_remotes || ! has_targets; then
|
||||||
ui_first_run_wizard
|
ui_first_run_wizard
|
||||||
fi
|
fi
|
||||||
ui_main_menu
|
ui_main_menu
|
||||||
|
|||||||
@@ -9,46 +9,52 @@ ui_first_run_wizard() {
|
|||||||
ui_msgbox "Welcome to gniza Backup Manager!\n\nThis wizard will help you set up your first backup:\n\n 1. Configure a backup destination (remote)\n 2. Define what to back up (target)\n 3. Optionally run your first backup\n\nPress OK to start, or Cancel to skip." \
|
ui_msgbox "Welcome to gniza Backup Manager!\n\nThis wizard will help you set up your first backup:\n\n 1. Configure a backup destination (remote)\n 2. Define what to back up (target)\n 3. Optionally run your first backup\n\nPress OK to start, or Cancel to skip." \
|
||||||
|| return 0
|
|| return 0
|
||||||
|
|
||||||
# Step 2: Create first remote
|
# Step 2: Create first remote (skip if one already exists)
|
||||||
ui_msgbox "Step 1 of 3: Configure Backup Destination\n\nChoose where your backups will be stored:\n - SSH server\n - Local directory (USB/NFS)\n - Amazon S3\n - Google Drive"
|
if ! has_remotes; then
|
||||||
|
ui_msgbox "Step 1: Configure Backup Destination\n\nChoose where your backups will be stored:\n - SSH server\n - Local directory (USB/NFS)\n - Amazon S3\n - Google Drive"
|
||||||
|
|
||||||
local remote_created=false
|
local remote_created=false
|
||||||
while ! $remote_created; do
|
while ! $remote_created; do
|
||||||
ui_remote_add
|
ui_remote_add
|
||||||
if has_remotes; then
|
if has_remotes; then
|
||||||
remote_created=true
|
remote_created=true
|
||||||
else
|
else
|
||||||
if ! ui_yesno "No remote was created.\n\nWould you like to try again?"; then
|
if ! ui_yesno "No remote was created.\n\nWould you like to try again?"; then
|
||||||
ui_msgbox "You can configure remotes later from the main menu.\n\nSetup wizard exiting."
|
ui_msgbox "You can configure remotes later from the main menu.\n\nSetup wizard exiting."
|
||||||
return 0
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
# Step 3: Create first target
|
# Step 3: Create first target (skip if one already exists)
|
||||||
ui_msgbox "Step 2 of 3: Define Backup Target\n\nChoose a name for your backup profile and select the folders you want to back up."
|
if ! has_targets; then
|
||||||
|
ui_msgbox "Step 2: Define Backup Target\n\nChoose a name for your backup profile and select the folders you want to back up."
|
||||||
|
|
||||||
local target_created=false
|
local target_created=false
|
||||||
while ! $target_created; do
|
while ! $target_created; do
|
||||||
ui_target_add
|
ui_target_add
|
||||||
if has_targets; then
|
if has_targets; then
|
||||||
target_created=true
|
target_created=true
|
||||||
else
|
else
|
||||||
if ! ui_yesno "No target was created.\n\nWould you like to try again?"; then
|
if ! ui_yesno "No target was created.\n\nWould you like to try again?"; then
|
||||||
ui_msgbox "You can configure targets later from the main menu.\n\nSetup wizard exiting."
|
ui_msgbox "You can configure targets later from the main menu.\n\nSetup wizard exiting."
|
||||||
return 0
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 4: Optionally run first backup (only if both exist)
|
||||||
|
if has_remotes && has_targets; then
|
||||||
|
local target
|
||||||
|
target=$(list_targets | head -1)
|
||||||
|
local remote
|
||||||
|
remote=$(list_remotes | head -1)
|
||||||
|
|
||||||
|
if ui_yesno "Run First Backup?\n\nTarget: $target\nRemote: $remote\n\nRun your first backup now?"; then
|
||||||
|
_ui_run_backup "$target" "$remote"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Step 4: Optionally run first backup
|
|
||||||
local target
|
|
||||||
target=$(list_targets | head -1)
|
|
||||||
local remote
|
|
||||||
remote=$(list_remotes | head -1)
|
|
||||||
|
|
||||||
if ui_yesno "Step 3 of 3: Run First Backup?\n\nTarget: $target\nRemote: $remote\n\nRun your first backup now?"; then
|
|
||||||
_ui_run_backup "$target" "$remote"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|||||||
Reference in New Issue
Block a user