fix: write user home to /tmp/.migration_home before sudo install

This commit is contained in:
Zenaku 2026-09-26 15:59:34 +02:00
parent 43f09f76bc
commit 09fd80ca34

View file

@ -15,6 +15,7 @@ BACKUP_DIR="$HOME/.wg-migration"
LOG="$BACKUP_DIR/migration.log"
REPO_URL="git@git.simplifiedprivacy.com:zenaku/operator-docker.git"
OPERATOR_DIR="$HOME/operator-docker"
USER_HOME="$HOME"
ok() { echo -e "${GREEN}[OK]${RESET} $1"; echo "[OK] $1" >> "$LOG"; }
info() { echo -e "${CYAN}[i]${RESET} $1"; echo "[i] $1" >> "$LOG"; }
@ -184,7 +185,9 @@ echo ""
cd "$OPERATOR_DIR"
sudo systemctl start nginx 2>/dev/null || true
sudo MIGRATION_MODE=1 bash install.sh || fail "Installer failed. Check output above."
echo "$USER_HOME" > /tmp/.migration_home
sudo MIGRATION_MODE=1 bash install.sh || { rm -f /tmp/.migration_home; fail "Installer failed. Check output above."; }
rm -f /tmp/.migration_home
if _env_is_corrupt "$OPERATOR_DIR/.env"; then
fail "install.sh finished but generated an invalid .env. Check install.sh."
@ -242,3 +245,5 @@ echo " Installation complete"
echo " Next: bash 02-migrate-peers.sh"
echo "========================================="
echo ""
SCRIPT
echo "done"