diff --git a/scripts/server-move/mac-cutover.sh b/scripts/server-move/mac-cutover.sh index d442cff2..7397fba4 100755 --- a/scripts/server-move/mac-cutover.sh +++ b/scripts/server-move/mac-cutover.sh @@ -20,13 +20,14 @@ SERVICES="bot watchdog web observer" S true || die "сервер недоступен" say "живых сессий агентов: $(sqlite3 -readonly "$PH/peppa.db" "select count(*) from sessions where status not in ('done','failed')")" DIRS=$(sqlite3 -readonly "$PH/peppa.db" "select workspace_path from projects where deleted_at is null; select workspace_path from sessions where workspace_path is not null and status not in ('done','failed');" | sort -u) +LIVE=$(sqlite3 -readonly "$PH/peppa.db" "select workspace_path from projects where key = '${PEPPA_PLATFORM_KEY:-PEP}'") LOST=0 for d in $DIRS; do [ -d "$d/.git" ] || [ -f "$d/.git" ] || continue - [ -d "$d/scripts/server-move" ] || [ -f "$d/scripts/live-deploy.sh" ] && continue # сама платформа: её код уже в Gitea + [ "$d" = "$LIVE" ] && continue # живая копия платформы: в ней не коммитят, её код уже в Gitea br=$(git -C "$d" branch --show-current 2>/dev/null || true) - dirty=$(git -C "$d" status --porcelain 2>/dev/null | grep -v '^?? .peppa/' | wc -l | tr -d ' ') - ahead=$(git -C "$d" log --oneline --branches --not --remotes 2>/dev/null | wc -l | tr -d ' ') + dirty=$(git -C "$d" status --porcelain 2>/dev/null | { grep -v '^?? .peppa/' || true; } | wc -l | tr -d ' ') + ahead=$(git -C "$d" log --oneline HEAD --not --remotes 2>/dev/null | wc -l | tr -d ' ') [ "$dirty" = 0 ] && [ "$ahead" = 0 ] && continue say "не в Gitea: $d (ветка ${br:-?}, изменённых файлов $dirty, неотправленных коммитов $ahead)" [ "$MODE" = go ] || continue