Add --no-ui flag

This commit is contained in:
2026-10-02 13:09:40 +03:00
parent a013ec6131
commit 1f580ae150
2 changed files with 28 additions and 4 deletions
+4 -3
View File
@@ -12,7 +12,7 @@
#
# Usage:
# ./migrate.sh [--config FILE] [--dest DIR] [--only NAME] [--jobs N]
# [--dry-run] [--list-only] [-h|--help]
# [--dry-run] [--list-only] [--no-ui] [-h|--help]
#
set -euo pipefail
@@ -24,7 +24,7 @@ ONLY_NAME=""
JOBS=1
DRY_RUN=0
LIST_ONLY=0
NO_UI=0
# QNAP system/internal folders that must never be copied or treated as real shares.
SYSTEM_SHARE_EXCLUDES=(
".system" ".system_trash" ".qsync_trash" ".@__thumb" ".@__thumb_mobile"
@@ -371,6 +371,7 @@ while [ $# -gt 0 ]; do
--jobs) JOBS="$2"; shift 2 ;;
--dry-run) DRY_RUN=1; shift ;;
--list-only) LIST_ONLY=1; shift ;;
--no-ui) NO_UI=1; shift ;;
-h|--help) usage ;;
*) die "unknown argument: $1" ;;
esac
@@ -386,7 +387,7 @@ mkdir -p "$LOG_DIR" "$DEST_ROOT"
log "Starting migration. dest=$DEST_ROOT dry_run=$DRY_RUN list_only=$LIST_ONLY"
# Dashboard needs a terminal, no dry/list run, and no interactive SMB password prompt.
if [ -t 1 ] && [ "$DRY_RUN" -eq 0 ] && [ "$LIST_ONLY" -eq 0 ]; then
if [ -t 1 ] && [ "$NO_UI" -eq 0 ] && [ "$DRY_RUN" -eq 0 ] && [ "$LIST_ONLY" -eq 0 ]; then
ui_ok=1
while IFS= read -r -u 4 line || [ -n "$line" ]; do
line="${line%%#*}"; line="${line//$'\r'/}"