#!/bin/bash
# Script pour mettre à jour les UUID dans Drupal 11

CONFIG_DIR="/var/www/html/config/sync"
NEW_UUID="920431be-88e8-438e-862d-350baac6b0a3"  # Remplacez par votre UUID réel

if [ ! -d "$CONFIG_DIR" ]; then
  echo "ERREUR: Le dossier $CONFIG_DIR n'existe pas"
  exit 1
fi

echo "Début de la mise à jour des UUID..."
find "$CONFIG_DIR" -name "*.yml" -exec sed -i "s/uuid: .*/uuid: $NEW_UUID/g" {} \;

echo "Vérification des modifications..."
grep -r "uuid:" "$CONFIG_DIR" | head -n 5

echo "Mise à jour terminée !"