Actualizar 01-migrate-user.sh

This commit is contained in:
Zenaku 2026-08-31 15:25:57 +00:00
parent 3a608a4958
commit 2b74c5a72e

View file

@ -9,6 +9,18 @@ if [ "$EUID" -eq 0 ]; then
exit 1
fi
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; RESET='\033[0m'
#!/bin/bash -eu
# =============================================================================
# 01-migrate-user.sh — Run as Linux user (not root)
# Installs operator-docker and prepares for peer migration
# Auto-rollback: restores nginx, certs and legacy stack on failure
# =============================================================================
if [ "$EUID" -eq 0 ]; then
echo "[X] Run as your Linux user, not root"
exit 1
fi
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; RESET='\033[0m'
BACKUP_DIR="$HOME/.wg-migration"
@ -67,6 +79,8 @@ echo "[START-01] $(date '+%Y-%m-%d %H:%M:%S')" >> "$LOG"
sep
info "Checking prerequisites..."
docker info &>/dev/null || fail "No Docker access. Run: sudo usermod -aG docker $USER && newgrp docker"
[ -f "$BACKUP_DIR/private_key" ] || fail "No backup found. Run: sudo bash 00-migrate-root.sh"
[ -f "$BACKUP_DIR/wg0-legacy.conf" ] || fail "No peer backup found. Run: sudo bash 00-migrate-root.sh"
[ -f "$BACKUP_DIR/legacy_compose_dir" ] || fail "No legacy snapshot found. Run: sudo bash 00-migrate-root.sh"
@ -232,4 +246,4 @@ echo "========================================="
echo " Installation complete"
echo " Next: bash 02-migrate-peers.sh"
echo "========================================="
echo ""
echo ""