update-firstrun-script.bat 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. @echo off
  2. echo.
  3. echo [WaouW] Mise a Jour Script FirstRun
  4. echo ===================================
  5. echo.
  6. REM Vérifier que le nouveau script existe
  7. if not exist "firstrun-fixed-network.sh" (
  8. echo [ERREUR] firstrun-fixed-network.sh non trouve !
  9. echo Assurez-vous d'etre dans le dossier DEPLOY
  10. pause
  11. exit /b 1
  12. )
  13. echo [INFO] Script corrige trouve : firstrun-fixed-network.sh
  14. REM Détecter la partition boot de la carte SD
  15. echo [INFO] Detection de la carte SD...
  16. set SD_FOUND=0
  17. 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 (
  18. if exist %%d:\cmdline.txt (
  19. if exist %%d:\config.txt (
  20. echo [INFO] Partition boot Raspberry Pi detectee : %%d:\
  21. set SD_DRIVE=%%d:
  22. set SD_FOUND=1
  23. goto :update_script
  24. )
  25. )
  26. )
  27. if %SD_FOUND%==0 (
  28. echo [WARNING] Carte SD non detectee automatiquement
  29. echo.
  30. echo Lecteurs disponibles :
  31. 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 (
  32. if exist %%d:\ (
  33. echo %%d:\
  34. )
  35. )
  36. echo.
  37. set /p SD_DRIVE="Entrez la lettre de la carte SD (ex: E:): "
  38. if "%SD_DRIVE%"=="" (
  39. echo [ERREUR] Lettre de lecteur requise
  40. pause
  41. exit /b 1
  42. )
  43. REM Ajouter : si pas present
  44. if not "%SD_DRIVE:~-1%"==":" set SD_DRIVE=%SD_DRIVE%:
  45. REM Verifier que c'est une partition boot Pi
  46. if not exist "%SD_DRIVE%\cmdline.txt" (
  47. echo [ERREUR] %SD_DRIVE% ne semble pas etre une partition boot Raspberry Pi
  48. pause
  49. exit /b 1
  50. )
  51. )
  52. :update_script
  53. echo [INFO] Carte SD confirmee : %SD_DRIVE%
  54. REM Sauvegarder l'ancien script s'il existe
  55. if exist "%SD_DRIVE%\firstrun.sh" (
  56. echo [INFO] Sauvegarde de l'ancien firstrun.sh...
  57. copy "%SD_DRIVE%\firstrun.sh" "%SD_DRIVE%\firstrun.sh.backup.%date:~-4,4%%date:~-10,2%%date:~-7,2%"
  58. if %errorlevel% equ 0 (
  59. echo [OK] Sauvegarde creee : firstrun.sh.backup.%date:~-4,4%%date:~-10,2%%date:~-7,2%
  60. ) else (
  61. echo [WARNING] Echec de la sauvegarde, continuation...
  62. )
  63. )
  64. REM Copier le nouveau script
  65. echo [INFO] Copie du script firstrun corrige...
  66. copy "firstrun-fixed-network.sh" "%SD_DRIVE%\firstrun.sh"
  67. if %errorlevel% neq 0 (
  68. echo [ERREUR] Echec de la copie du script
  69. pause
  70. exit /b 1
  71. )
  72. echo [OK] Script firstrun.sh mis a jour sur %SD_DRIVE%
  73. REM Verification que la copie est correcte
  74. echo [INFO] Verification de la copie...
  75. if exist "%SD_DRIVE%\firstrun.sh" (
  76. REM Vérifier qu'il contient la detection reseau amelioree
  77. findstr /C:"détection réseau robuste" "%SD_DRIVE%\firstrun.sh" >nul
  78. if %errorlevel% equ 0 (
  79. echo [OK] Script corrige confirme (detection reseau amelioree detectee)
  80. ) else (
  81. findstr /C:"wait_for_network" "%SD_DRIVE%\firstrun.sh" >nul
  82. if %errorlevel% equ 0 (
  83. echo [OK] Script corrige confirme (fonction wait_for_network detectee)
  84. ) else (
  85. echo [WARNING] Script copie mais impossible de confirmer les ameliorations
  86. )
  87. )
  88. ) else (
  89. echo [ERREUR] Fichier firstrun.sh non trouve apres copie !
  90. pause
  91. exit /b 1
  92. )
  93. REM Vérifier la presence de l'archive
  94. if exist "%SD_DRIVE%\waouw-deploy.zip" (
  95. echo [OK] Archive WaouW presente : waouw-deploy.zip
  96. ) else (
  97. echo [WARNING] Archive waouw-deploy.zip non trouvee sur la SD
  98. echo [INFO] Si necessaire, copiez l'archive avec :
  99. echo copy "..\dist\waouw-v2-image-latest.zip" "%SD_DRIVE%\waouw-deploy.zip"
  100. )
  101. REM Vérifier cmdline.txt
  102. if exist "%SD_DRIVE%\cmdline.txt" (
  103. findstr /C:"systemd.run=/boot/firstrun.sh" "%SD_DRIVE%\cmdline.txt" >nul
  104. if %errorlevel% equ 0 (
  105. echo [OK] cmdline.txt configure pour auto-installation
  106. ) else (
  107. echo [WARNING] cmdline.txt ne semble pas configure pour firstrun.sh
  108. echo [INFO] Contenu actuel :
  109. type "%SD_DRIVE%\cmdline.txt"
  110. echo.
  111. echo [INFO] Si necessaire, executez : fix-firstrun-path.bat
  112. )
  113. )
  114. echo.
  115. echo ========================================
  116. echo SCRIPT FIRSTRUN MIS A JOUR !
  117. echo ========================================
  118. echo.
  119. echo Fichiers sur %SD_DRIVE% :
  120. echo - firstrun.sh ^(SCRIPT CORRIGE avec detection reseau robuste^)
  121. echo - waouw-deploy.zip ^(Archive WaouW^)
  122. echo - cmdline.txt ^(Configuration boot^)
  123. echo.
  124. echo AMELIORATIONS DU SCRIPT :
  125. echo ✅ Timeout reseau etendu ^(10 minutes^)
  126. echo ✅ 5 methodes de test connectivite
  127. echo ✅ Diagnostic detaille en cas d'echec
  128. echo ✅ Detection passerelle locale
  129. echo ✅ Tests DNS multiples
  130. echo.
  131. echo PROCHAINES ETAPES :
  132. echo 1. Ejecter proprement la carte SD
  133. echo 2. Inserer dans le Raspberry Pi
  134. echo 3. Demarrer le Pi ^(avec connexion Internet^)
  135. echo 4. Attendre 30-45 minutes ^(plus long mais plus fiable^)
  136. echo 5. Verifier : http://waouw.local:7165
  137. echo.
  138. echo FICHIERS DE STATUT APRES INSTALLATION :
  139. echo - waouw-install-success.txt ^(si succes^)
  140. echo - waouw-network-error.txt ^(si probleme reseau^)
  141. echo - waouw-install-error.txt ^(si probleme installation^)
  142. echo.
  143. pause