1
0

waouw-start-final.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # WAOUW v2.0 - SCRIPT FINAL D'AUTO-INSTALLATION
  3. # Cree automatiquement
  4. # INDICATEUR VISUEL IMMEDIAT
  5. echo "WAOUW-STARTED" > /boot/waouw-started.txt
  6. date >> /boot/waouw-started.txt
  7. # LOG COMPLET
  8. exec >> >(tee -a /var/log/waouw-install.log) 2>&1
  9. echo "=== WAOUW AUTO-INSTALL $(date) ==="
  10. echo "WAOUW: Script demarre..."
  11. # Attendre que le systeme soit pret
  12. echo "WAOUW: Attente systeme (30s)..."
  13. sleep 30
  14. # Attendre la connectivite reseau
  15. echo "WAOUW: Test reseau..."
  16. for i in {1..15}; do
  17. if ping -c 1 8.8.8.8 > /dev/null 2>&1; then
  18. echo "WAOUW: Reseau OK"
  19. break
  20. fi
  21. if [[ $i -eq 15 ]]; then
  22. echo "WAOUW: ERREUR - Pas de reseau"
  23. echo "WAOUW: Pas de reseau" > /boot/waouw-no-network.txt
  24. exit 1
  25. fi
  26. echo "WAOUW: Tentative reseau $i/15..."
  27. sleep 5
  28. done
  29. # Verifier que l'archive existe
  30. if [[ ! -f /boot/waouw-deploy.zip ]]; then
  31. echo "WAOUW: ERREUR - Archive manquante"
  32. echo "WAOUW: Archive manquante" > /boot/waouw-no-archive.txt
  33. exit 1
  34. fi
  35. echo "WAOUW: Archive trouvee, taille: $(ls -lh /boot/waouw-deploy.zip | awk '{print $5}')"
  36. # Creer le repertoire d'installation
  37. echo "WAOUW: Preparation installation..."
  38. mkdir -p /opt/waouw
  39. cd /opt/waouw
  40. # Decompresser l'archive
  41. echo "WAOUW: Decompression archive..."
  42. unzip -q /boot/waouw-deploy.zip
  43. if [[ $? -ne 0 ]]; then
  44. echo "WAOUW: ERREUR - Decompression echouee"
  45. echo "WAOUW: Decompression echouee" > /boot/waouw-decompress-error.txt
  46. exit 1
  47. fi
  48. echo "WAOUW: Archive decompressee"
  49. # Aller dans le repertoire WaouW
  50. cd waouw-deploy
  51. # Verifier que les fichiers existent
  52. if [[ ! -f "DEPLOY/install-complete.sh" ]]; then
  53. echo "WAOUW: ERREUR - Fichiers d'installation manquants"
  54. echo "WAOUW: Fichiers manquants" > /boot/waouw-missing-files.txt
  55. ls -la
  56. exit 1
  57. fi
  58. echo "WAOUW: Fichiers d'installation trouves"
  59. # Rendre les scripts executables
  60. echo "WAOUW: Configuration permissions..."
  61. chmod +x DEPLOY/*.sh
  62. chmod +x install.sh
  63. # LANCER L'INSTALLATION COMPLETE
  64. echo "WAOUW: LANCEMENT INSTALLATION WAOUW v2.0..."
  65. ./DEPLOY/install-complete.sh
  66. INSTALL_CODE=$?
  67. # Verifier le resultat
  68. if [[ $INSTALL_CODE -eq 0 ]]; then
  69. echo "WAOUW: SUCCES TOTAL !"
  70. touch /opt/waouw/.installed
  71. LOCAL_IP=$(hostname -I | awk '{print $1}')
  72. echo "WaouW v2.0 - INSTALLATION REUSSIE" > /boot/waouw-success.txt
  73. echo "IP: $LOCAL_IP" >> /boot/waouw-success.txt
  74. echo "Acces: http://waouw.local:7165" >> /boot/waouw-success.txt
  75. echo "Date: $(date)" >> /boot/waouw-success.txt
  76. echo "WAOUW: Installation terminee avec succes"
  77. else
  78. echo "WAOUW: ERREUR INSTALLATION (code: $INSTALL_CODE)"
  79. echo "WaouW v2.0 - ERREUR (code: $INSTALL_CODE)" > /boot/waouw-error.txt
  80. echo "Date: $(date)" >> /boot/waouw-error.txt
  81. fi
  82. echo "=== WAOUW AUTO-INSTALL TERMINE $(date) ==="
  83. echo "WAOUW-FINISHED" > /boot/waouw-finished.txt
  84. date >> /boot/waouw-finished.txt