@echo off echo. echo [WaouW] Configuration Auto-Boot echo =============================== echo. REM Détecter la partition boot 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 ( set BOOT_DRIVE=%%d: goto :found_boot ) ) echo [ERREUR] Partition boot Raspberry Pi non detectee pause exit /b 1 :found_boot echo [INFO] Partition boot detectee : %BOOT_DRIVE% echo. REM Sauvegarder l'original cmdline.txt if not exist "%BOOT_DRIVE%\cmdline.txt.backup" ( echo [INFO] Sauvegarde de cmdline.txt original... copy "%BOOT_DRIVE%\cmdline.txt" "%BOOT_DRIVE%\cmdline.txt.backup" ) REM Lire le contenu actuel de cmdline.txt for /f "delims=" %%i in (%BOOT_DRIVE%\cmdline.txt) do set CMDLINE=%%i REM Vérifier si notre modification est déjà présente echo %CMDLINE% | find "systemd.run_success_action" >nul if %errorlevel% equ 0 ( echo [INFO] Auto-installation deja configuree dans cmdline.txt goto :create_service ) REM Ajouter la configuration pour l'auto-installation echo [INFO] Modification de cmdline.txt pour auto-installation... echo %CMDLINE% systemd.run_success_action=reboot systemd.unit=waouw-autoinstall.service > "%BOOT_DRIVE%\cmdline.txt" :create_service REM Créer le service systemd pour l'auto-installation echo [INFO] Creation du service d'auto-installation... REM Créer waouw-autoinstall.service avec encodage UTF-8 powershell -Command "Set-Content -Path '%BOOT_DRIVE%\waouw-autoinstall.service' -Value @' [Unit] Description=WaouW Auto Installation Service After=network-online.target Wants=network-online.target DefaultDependencies=false [Service] Type=oneshot ExecStart=/boot/firstrun.sh StandardOutput=journal+console StandardError=journal+console RemainAfterExit=yes KillMode=process TimeoutSec=0 [Install] WantedBy=multi-user.target '@ -Encoding UTF8" REM Créer le script qui active le service echo [INFO] Creation du script d'activation... REM Créer bootstrap.sh avec encodage UTF-8 powershell -Command "Set-Content -Path '%BOOT_DRIVE%\bootstrap.sh' -Value @' #!/bin/bash # WaouW Auto-Installation Bootstrap # Copier le service vers le bon emplacement cp /boot/waouw-autoinstall.service /etc/systemd/system/ # Activer le service systemctl enable waouw-autoinstall.service # Demarrer le service maintenant systemctl start waouw-autoinstall.service '@ -Encoding UTF8" REM Modifier firstrun.sh pour qu'il soit exécutable et démarre le bootstrap echo [INFO] Mise a jour du script firstrun.sh... REM Créer firstrun_new.sh avec encodage UTF-8 powershell -Command "Set-Content -Path '%BOOT_DRIVE%\firstrun_new.sh' -Value @' #!/bin/bash # WaouW Auto-Installation avec Bootstrap set +e # Rendre executable et lancer le bootstrap si première fois if [ ! -f /var/log/waouw-bootstrap.done ]; then chmod +x /boot/bootstrap.sh /boot/bootstrap.sh touch /var/log/waouw-bootstrap.done fi '@ -Encoding UTF8" REM Ajouter le contenu existant du firstrun.sh type "%BOOT_DRIVE%\firstrun.sh" >> "%BOOT_DRIVE%\firstrun_new.sh" REM Remplacer l'ancien par le nouveau move "%BOOT_DRIVE%\firstrun_new.sh" "%BOOT_DRIVE%\firstrun.sh" chmod +x "%BOOT_DRIVE%\firstrun.sh" 2>nul echo [INFO] Creation du fichier README d'instructions... REM Créer README avec encodage UTF-8 powershell -Command "Set-Content -Path '%BOOT_DRIVE%\WAOUW-AUTOINSTALL-README.txt' -Value @' WaouW v2.0 - Configuration Auto-Installation =========================================== Cette carte SD est maintenant configuree pour installer automatiquement WaouW v2.0 au premier demarrage. MODIFICATION APPORTEES : - cmdline.txt modifie pour declencher l'auto-installation - Service systemd cree : waouw-autoinstall.service - Script bootstrap ajoute pour l'activation - Encodage UTF-8 corrige pour tous les fichiers PROCESSUS D'INSTALLATION : 1. Inserer cette SD dans le Raspberry Pi 2. Demarrer le Pi (AVEC connexion Internet) 3. Le Pi va demarrer et lancer automatiquement l'installation 4. Attendre 20-40 minutes pour l'installation complete 5. L'installation est terminee quand vous pouvez acceder a l'interface ACCES APRES INSTALLATION : - Interface : http://[IP-DU-PI]:7165 - Login : admin / admin (a changer immediatement) VERIFICATION : - Connectez-vous en SSH : ssh pi@[IP-DU-PI] - Verifiez les logs : journalctl -u waouw-autoinstall Date configuration : %date% %time% '@ -Encoding UTF8" echo. echo ======================================== echo AUTO-INSTALLATION CONFIGUREE ! echo ======================================== echo. echo Modifications apportees a %BOOT_DRIVE% : echo - cmdline.txt modifie pour declencher l'installation echo - waouw-autoinstall.service cree (encodage UTF-8) echo - bootstrap.sh cree pour l'activation (encodage UTF-8) echo - firstrun.sh mis a jour (encodage UTF-8) echo - README d'instructions ajoute (encodage UTF-8) echo. echo IMPORTANT : echo Cette SD va maintenant installer WaouW AUTOMATIQUEMENT echo au premier demarrage du Raspberry Pi. 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 20-40 minutes echo 5. Acceder a http://[IP-PI]:7165 echo. pause