| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- # WaouW v2.0 - Préparation SD Automatique
- param(
- [string]$DriveLetter = "E:"
- )
- Write-Host "=== WaouW v2.0 - Preparation SD Automatique ===" -ForegroundColor Cyan
- # Vérifier la lettre du lecteur
- if (!(Test-Path "$DriveLetter")) {
- Write-Host "Erreur: Lecteur $DriveLetter introuvable" -ForegroundColor Red
- exit 1
- }
- if (!(Test-Path "$DriveLetter\cmdline.txt")) {
- Write-Host "Erreur: $DriveLetter n'est pas une partition boot Raspberry Pi" -ForegroundColor Red
- exit 1
- }
- Write-Host "Preparation de la carte SD: $DriveLetter" -ForegroundColor Green
- # Copier l'archive
- Write-Host "Copie de l'archive WaouW..."
- Copy-Item "..\waouw-deploy.zip" "$DriveLetter\waouw-deploy.zip" -Force
- # Copier les scripts d'installation automatique
- Write-Host "Copie des scripts d'installation automatique..."
- Copy-Item "install-simple.sh" "$DriveLetter\install.sh" -Force
- # Script de démarrage simplifié créé dans install.sh
- # Créer configuration autologin
- Write-Host "Configuration autologin automatique..."
- $autologinConf = @"
- [Service]
- ExecStart=
- ExecStart=-/sbin/agetty --autologin pi --noclear %I `$TERM
- "@
- $autologinConf | Out-File -FilePath "$DriveLetter\autologin.conf" -Encoding UTF8 -Force
- # Créer script post-login
- Write-Host "Création du script post-login..."
- $postLogin = @"
- #!/bin/bash
- # WaouW Post-Login Auto-Start
- # Attendre un peu
- sleep 5
- # Lancer le script de démarrage
- if [ -f /boot/firmware/waouw-start.sh ]; then
- echo "Lancement WaouW..."
- bash /boot/firmware/waouw-start.sh
- fi
- "@
- $postLogin | Out-File -FilePath "$DriveLetter\post-login.sh" -Encoding UTF8 -Force
- # Modifier cmdline.txt pour autologin (méthode alternative)
- Write-Host "Configuration cmdline.txt pour autologin..."
- $cmdlinePath = "$DriveLetter\cmdline.txt"
- if (Test-Path $cmdlinePath) {
- $cmdline = Get-Content $cmdlinePath -Raw
- # Ajouter console=tty1 au cmdline pour forcer l'autologin
- if ($cmdline -notlike "*console=tty1*") {
- $cmdline = $cmdline.Trim() + " console=tty1"
- $cmdline | Out-File -FilePath $cmdlinePath -Encoding UTF8 -NoNewline
- }
- }
- # Créer le fichier .env
- Write-Host "Creation du fichier .env..."
- $envContent = @"
- # WaouW v2.0 - Configuration Automatique
- WAOUW_DOMAIN=waouw.local
- ACME_EMAIL=ssl-agent@waouw.tech
- # Database
- POSTGRES_PASSWORD=waouw123
- DATABASE_URL=postgresql://waouw:waouw123@postgres:5432/waouw
- # Security
- JWT_SECRET_KEY=auto-secret-key-2024
- DEVICE_HMAC_SECRET=auto-device-secret-2024
- # Cache
- REDIS_URL=redis://redis:6379/0
- # Email (optional services)
- MAIL_MYSQL_ROOT_PASSWORD=mailroot2024
- MAIL_MYSQL_PASSWORD=mailpass2024
- SMTP_PASSWORD=smtppass2024
- # Nextcloud (optional)
- NEXTCLOUD_MYSQL_ROOT_PASSWORD=nextroot2024
- NEXTCLOUD_MYSQL_PASSWORD=nextpass2024
- NEXTCLOUD_ADMIN_PASSWORD=nextadmin2024
- # System
- PHPMYADMIN_PASSWORD=phpmyadmin2024
- WEBMIN_ROOT_PASSWORD=webmin2024
- # Monitoring (optional)
- GRAYLOG_PASSWORD_SECRET=graylogsecret2024
- GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
- GRAFANA_ADMIN_PASSWORD=grafana2024
- # Services
- PROMETHEUS_ENABLED=true
- GRAFANA_ENABLED=true
- TZ=Europe/Paris
- "@
- $envContent | Out-File -FilePath "$DriveLetter\.env" -Encoding UTF8
- # Créer le fichier README
- Write-Host "Creation du fichier README..."
- $readme = @"
- WaouW v2.0 - Installation Automatique
- =====================================
- Cette carte SD est preparee pour une installation 100% automatique de WaouW v2.0.
- PROCESSUS :
- 1. Inserer cette carte SD dans votre Raspberry Pi
- 2. Brancher l'alimentation
- 3. Attendre 5-10 minutes (installation automatique)
- 4. Acceder a WaouW : http://waouw.local
- UTILISATEUR :
- - Login : admin
- - Mot de passe : admin
- L'installation se fait entierement automatiquement !
- "@
- $readme | Out-File -FilePath "$DriveLetter\WAOUW-README.txt" -Encoding ASCII
- Write-Host ""
- Write-Host "=== PREPARATION TERMINEE ===" -ForegroundColor Green
- Write-Host "Carte SD prete pour installation automatique !" -ForegroundColor Green
- Write-Host ""
- Write-Host "Prochaines etapes :" -ForegroundColor Yellow
- Write-Host "1. Ejecter la carte SD proprement" -ForegroundColor Yellow
- Write-Host "2. Inserer dans le Raspberry Pi" -ForegroundColor Yellow
- Write-Host "3. Brancher l'alimentation" -ForegroundColor Yellow
- Write-Host "4. Attendre 5-10 minutes" -ForegroundColor Yellow
- Write-Host "5. Acceder a http://waouw.local" -ForegroundColor Yellow
- Write-Host ""
- pause
|