Premier commit
Cette révision appartient à :
révision
43ac041278
6 fichiers modifiés
+705
Aucun fichier ne correspond à votre recherche
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Retour arrière d'une migration : retour.sh <dossier-données> <dossier sauvegarde-migration-…>
|
||||
set -euo pipefail
|
||||
D=$(realpath "$1"); S=$(realpath "$2")
|
||||
[ -f "$S/MANIFESTE.json" ] || { echo "MANIFESTE.json absent dans $S"; exit 1; }
|
||||
if docker ps --format '{{.Names}}' 2>/dev/null | grep -qx minecraft-neoforge && [ ! -f "$D/COPIE-MIGRATION" ]; then
|
||||
echo "REFUS : serveur en ligne"; exit 1; fi
|
||||
python3 - "$D" "$S" <<'PY'
|
||||
import json,os,shutil,sys
|
||||
D,S=sys.argv[1:]; m=json.load(open(os.path.join(S,"MANIFESTE.json")))
|
||||
for r in m.get("crees",[]):
|
||||
p=os.path.join(D,r)
|
||||
if os.path.exists(p): os.remove(p); print("supprimé (créé par migration)",r)
|
||||
for r in m["fichiers"]:
|
||||
shutil.copy2(os.path.join(S,r),os.path.join(D,r)); print("restauré",r)
|
||||
if os.path.exists(os.path.join(D,r)+".avant-migration"): os.remove(os.path.join(D,r)+".avant-migration")
|
||||
for r in m.get("crees",[]):
|
||||
a=os.path.join(D,r)+".avant-migration"
|
||||
if os.path.exists(a): os.remove(a)
|
||||
PY
|
||||
echo "Retour arrière terminé."
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur