Actualizar 01-migrate-user.sh
This commit is contained in:
parent
3a608a4958
commit
2b74c5a72e
1 changed files with 15 additions and 1 deletions
|
|
@ -9,6 +9,18 @@ if [ "$EUID" -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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'
|
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; CYAN='\033[0;36m'; RESET='\033[0m'
|
||||||
|
|
||||||
BACKUP_DIR="$HOME/.wg-migration"
|
BACKUP_DIR="$HOME/.wg-migration"
|
||||||
|
|
@ -67,6 +79,8 @@ echo "[START-01] $(date '+%Y-%m-%d %H:%M:%S')" >> "$LOG"
|
||||||
sep
|
sep
|
||||||
info "Checking prerequisites..."
|
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/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/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"
|
[ -f "$BACKUP_DIR/legacy_compose_dir" ] || fail "No legacy snapshot found. Run: sudo bash 00-migrate-root.sh"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue