Installation de la carte SD et du système
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3KB

  1. #!/bin/bash
  2. # build.sh <id microsd (sdX)>
  3. set -e
  4. #set -x
  5. IMGMOUNT=./tmp
  6. REP=$(dirname $0)
  7. APT='DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes'
  8. IMGZIP=$(curl -s https://build.yunohost.org/images.json | grep rpi-stable | gawk -F\" '{print $4}')
  9. echo -e "Récupération de l'image : $IMGZIP\n"
  10. wget https://build.yunohost.org/$IMGZIP
  11. echo -e "Extraction de l'image...\n"
  12. unzip $IMGZIP
  13. rm $IMGZIP
  14. IMG=$(ls *.img | sed 's/yunohost/weblibre/')
  15. mv $(ls *.img) $IMG
  16. mkdir -p $IMGMOUNT
  17. echo -e "Configuration de l'image : $IMG \n"
  18. IMGDEV=$(losetup -f --show -P $IMG)
  19. mount ${IMGDEV}p2 $IMGMOUNT
  20. echo '. /etc/bash_completion' >> $IMGMOUNT/root/.bashrc
  21. # Personnalisation du system
  22. install -m 755 -o root -g root ${REP}/scripts/update-motd.d/* $IMGMOUNT/etc/update-motd.d/
  23. install -m 755 -o root -g root ${REP}/scripts/yunoprompt $IMGMOUNT/usr/bin/
  24. install -m 755 -o root -g root ${REP}/scripts/install_weblibre $IMGMOUNT/usr/bin/
  25. install -m 644 -o root -g root ${REP}/scripts/kodi.service $IMGMOUNT/etc/systemd/system/kodi.service
  26. # Création microSD
  27. umount $IMGMOUNT
  28. losetup -d $IMGDEV
  29. echo -e "Création de la microSD...\n"
  30. umount /dev/$1 || true
  31. dd if=$IMG of=/dev/$1 status=progress conv=fsync
  32. rm -f $IMG
  33. echo -e "Terminé ! Depuis le boitier, executer \"install_weblibre\"\n"
  34. exit 0