@echo off echo. echo [WaouW] Mise a Jour Script FirstRun echo =================================== echo. REM Vérifier que le nouveau script existe if not exist "firstrun-fixed-network.sh" ( echo [ERREUR] firstrun-fixed-network.sh non trouve ! echo Assurez-vous d'etre dans le dossier DEPLOY pause exit /b 1 ) echo [INFO] Script corrige trouve : firstrun-fixed-network.sh REM Détecter la partition boot de la carte SD echo [INFO] Detection de la carte SD... set SD_FOUND=0 for %%d in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( if exist %%d:\cmdline.txt ( if exist %%d:\config.txt ( echo [INFO] Partition boot Raspberry Pi detectee : %%d:\ set SD_DRIVE=%%d: set SD_FOUND=1 goto :update_script ) ) ) if %SD_FOUND%==0 ( echo [WARNING] Carte SD non detectee automatiquement echo. echo Lecteurs disponibles : for %%d in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( if exist %%d:\ ( echo %%d:\ ) ) echo. set /p SD_DRIVE="Entrez la lettre de la carte SD (ex: E:): " if "%SD_DRIVE%"=="" ( echo [ERREUR] Lettre de lecteur requise pause exit /b 1 ) REM Ajouter : si pas present if not "%SD_DRIVE:~-1%"==":" set SD_DRIVE=%SD_DRIVE%: REM Verifier que c'est une partition boot Pi if not exist "%SD_DRIVE%\cmdline.txt" ( echo [ERREUR] %SD_DRIVE% ne semble pas etre une partition boot Raspberry Pi pause exit /b 1 ) ) :update_script echo [INFO] Carte SD confirmee : %SD_DRIVE% REM Sauvegarder l'ancien script s'il existe if exist "%SD_DRIVE%\firstrun.sh" ( echo [INFO] Sauvegarde de l'ancien firstrun.sh... copy "%SD_DRIVE%\firstrun.sh" "%SD_DRIVE%\firstrun.sh.backup.%date:~-4,4%%date:~-10,2%%date:~-7,2%" if %errorlevel% equ 0 ( echo [OK] Sauvegarde creee : firstrun.sh.backup.%date:~-4,4%%date:~-10,2%%date:~-7,2% ) else ( echo [WARNING] Echec de la sauvegarde, continuation... ) ) REM Copier le nouveau script echo [INFO] Copie du script firstrun corrige... copy "firstrun-fixed-network.sh" "%SD_DRIVE%\firstrun.sh" if %errorlevel% neq 0 ( echo [ERREUR] Echec de la copie du script pause exit /b 1 ) echo [OK] Script firstrun.sh mis a jour sur %SD_DRIVE% REM Verification que la copie est correcte echo [INFO] Verification de la copie... if exist "%SD_DRIVE%\firstrun.sh" ( REM Vérifier qu'il contient la detection reseau amelioree findstr /C:"détection réseau robuste" "%SD_DRIVE%\firstrun.sh" >nul if %errorlevel% equ 0 ( echo [OK] Script corrige confirme (detection reseau amelioree detectee) ) else ( findstr /C:"wait_for_network" "%SD_DRIVE%\firstrun.sh" >nul if %errorlevel% equ 0 ( echo [OK] Script corrige confirme (fonction wait_for_network detectee) ) else ( echo [WARNING] Script copie mais impossible de confirmer les ameliorations ) ) ) else ( echo [ERREUR] Fichier firstrun.sh non trouve apres copie ! pause exit /b 1 ) REM Vérifier la presence de l'archive if exist "%SD_DRIVE%\waouw-deploy.zip" ( echo [OK] Archive WaouW presente : waouw-deploy.zip ) else ( echo [WARNING] Archive waouw-deploy.zip non trouvee sur la SD echo [INFO] Si necessaire, copiez l'archive avec : echo copy "..\dist\waouw-v2-image-latest.zip" "%SD_DRIVE%\waouw-deploy.zip" ) REM Vérifier cmdline.txt if exist "%SD_DRIVE%\cmdline.txt" ( findstr /C:"systemd.run=/boot/firstrun.sh" "%SD_DRIVE%\cmdline.txt" >nul if %errorlevel% equ 0 ( echo [OK] cmdline.txt configure pour auto-installation ) else ( echo [WARNING] cmdline.txt ne semble pas configure pour firstrun.sh echo [INFO] Contenu actuel : type "%SD_DRIVE%\cmdline.txt" echo. echo [INFO] Si necessaire, executez : fix-firstrun-path.bat ) ) echo. echo ======================================== echo SCRIPT FIRSTRUN MIS A JOUR ! echo ======================================== echo. echo Fichiers sur %SD_DRIVE% : echo - firstrun.sh ^(SCRIPT CORRIGE avec detection reseau robuste^) echo - waouw-deploy.zip ^(Archive WaouW^) echo - cmdline.txt ^(Configuration boot^) echo. echo AMELIORATIONS DU SCRIPT : echo ✅ Timeout reseau etendu ^(10 minutes^) echo ✅ 5 methodes de test connectivite echo ✅ Diagnostic detaille en cas d'echec echo ✅ Detection passerelle locale echo ✅ Tests DNS multiples echo. echo PROCHAINES ETAPES : echo 1. Ejecter proprement la carte SD echo 2. Inserer dans le Raspberry Pi echo 3. Demarrer le Pi ^(avec connexion Internet^) echo 4. Attendre 30-45 minutes ^(plus long mais plus fiable^) echo 5. Verifier : http://waouw.local:7165 echo. echo FICHIERS DE STATUT APRES INSTALLATION : echo - waouw-install-success.txt ^(si succes^) echo - waouw-network-error.txt ^(si probleme reseau^) echo - waouw-install-error.txt ^(si probleme installation^) echo. pause