選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

85 行
3.3 KiB

  1. #!/bin/bash
  2. # Allo-GG
  3. # Installation de Allo-GG sur un Pi Zero avec Rasbian.
  4. # Configuration du nom reseau du module
  5. echo "allo-gg" > /etc/hostname
  6. # MAJ et installation des utilitaires
  7. cd || exit
  8. apt-get -y update
  9. apt-get -y upgrade
  10. apt-get -y install apache2 php7.0 git-core vim tree rsync lsof curl screen
  11. # Installation de log2ram
  12. git clone https://github.com/azlux/log2ram.git
  13. cd log2ram || exit
  14. chmod +x install.sh
  15. ./install.sh
  16. cd || exit
  17. # Installation de wiringPi
  18. git clone git://git.drogon.net/wiringPi
  19. cd wiringPi || exit
  20. chmod +x build
  21. ./build
  22. cd || exit
  23. # Creation de l'utilisateur
  24. useradd --create-home allo-gg
  25. adduser allo-gg sudo
  26. echo allo-gg:allo-gg | chpasswd
  27. echo root:allo-gg | chpasswd
  28. # Execution automatique de bash a la connexion
  29. echo "bash" >> /home/allo-gg/.profile
  30. # Autoriser le reboot du module
  31. echo >> /etc/sudoers
  32. echo "## user is allowed to execute halt and reboot" >> /etc/sudoers
  33. echo "allo-gg ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff" >> /etc/sudoers
  34. echo "www-data ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff" >> /etc/sudoers
  35. # Autorisation de clefs SSH publiques
  36. mkdir /home/allo-gg/.ssh/
  37. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbvr8J95SXj0byVhBSOt/iShxzf0TVGKaxvo4d+pdrEaiDFxQEn/Iim9qEH9FXV9kQ8frUuYmVbh7Rqvh8QpTQM77eLHeZgXejw7St0OMmZSGpUsomIANZQNspDQ/qQbXFXmKnGJiC7TCEqaNoDTmHrdZ4Hvei4ly16e8Zic5pjcMruNeixcVkZOLJZWViGgbMlZN8jSll9pFfNRYKhIp6boalK5DexzgUZkUCk4HkPHo0I70LyElINmt9PkpHwzAFbsTRmI27Z9C5xI5OZ86aL+Kq4lm+MoD+f3hDiOdAByNqIEU1LU7tnMpQHbKSYSoVHlySF1+tuw3O1E4HQO45 heuzef@x240" >> /home/allo-gg/.ssh/authorized_keys
  38. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkdi/Nt+Remfwx5vM/lBmnTUOQ3+UJtbT4P1P+sOXt0dADUHj7gRvZxfb73n7A8y6rfocDiV4IRf1yvg8JWrAFC7/aDCMYDAOMAld9fKFU7u73beWl0zMSTVSGxt2MTSpyU+POx6VvucWppJQJN8R2VtAPHheUZlpLEf0n2gzgyYEYuHEOPHfx91u3omu4QCYRVWv4ZFRCCvznC2Cd+GW2S8uNqe6oxe2HuXtghAIRO+XXDSfwJc0lsm7uKMJ9rtQMYSYUI0f3HErHArf5ssQMCMcHivdJuoWEmvK2UarQdT5kKlytDUjFMrjj4Ks6+Ew6mdvp6H4/PeRjONaDWOQ3 karimcisse@Karims-MacBook-Air.local" >> /home/allo-gg/.ssh/authorized_keys
  39. # Desactiver toutes authentifications SSH par mot de passe
  40. echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
  41. echo "PermitRootLogin no" >> /etc/ssh/sshd_config
  42. # Desactiver les services innutiles
  43. systemctl disable bluetooth
  44. # Installation de Allo-GG
  45. rm -vf /var/www/html/index.html
  46. chown -R allo-gg:allo-gg /var/www/html/
  47. su -l allo-gg -c "git clone https://github.com/heuzef/Allo-GG.git /var/www/html/"
  48. mv -vf /var/www/html/log2ram.conf /etc/
  49. mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram
  50. # Lancement automatique du script de demarrage
  51. sed -i '1 i #!/bin/sh -e' /etc/rc.local
  52. sed -i '$ d' /etc/rc.local
  53. echo "/bin/bash /var/www/html/scripts/boot.sh &" >> /etc/rc.local
  54. echo "" >> /etc/rc.local
  55. echo "exit 0" >> /etc/rc.local
  56. # Mise en place de la routine de verification de l'etat des services
  57. # echo 'MAILTO=""' | crontab -u allo-gg -
  58. echo '*/20 * * * * allo-gg /var/www/html/scripts/check_services.sh > /dev/null' | crontab -u allo-gg -
  59. # Creation du fichier de log
  60. date > /var/www/html/ui/allo-gg.log
  61. echo "Installation du module ALLO-GG" >> /var/www/html/ui/allo-gg.log
  62. echo "----------------------------" >> /var/www/html/ui/allo-gg.log
  63. echo >> /var/www/html/ui/allo-gg.log
  64. echo
  65. echo "----------------------------"
  66. echo "Installation OK ! Redemarrage en cours ..."
  67. sleep 3
  68. sh /var/www/html/scripts/reboot.sh