install.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. set -e
  3. Version=1.0
  4. ##Configuration:##
  5. RPI3=YES # YES/NO
  6. SERIAL=YES #YES for serial (attiny), NO for USB (teensy/arduino)
  7. echo -e "Serial Minecraft LedStatus installer $Version:"
  8. echo
  9. echo -e "Install dependencies, libraries and tools :"
  10. if ! [ -x "$(command -v pip)" ]
  11. then
  12. sudo apt-get update
  13. sudo apt-get install python-pip python-serial -y
  14. fi
  15. if ! [ -x "$(command -v mcstatus)" ]
  16. then
  17. sudo pip install mcstatus
  18. fi
  19. echo -e "Done";
  20. echo
  21. if [ $RPI3 = "YES" ] && [ $SERIAL = "YES" ]
  22. then
  23. echo "Raspberry 3 Serial setup:"
  24. if ! grep "dtoverlay=pi3-disable-bt" /boot/config.txt >/dev/null
  25. then
  26. sudo bash -c 'echo "" >>/boot/config.txt'
  27. sudo bash -c 'echo "# Disable internal BT" >>/boot/config.txt'
  28. sudo bash -c 'echo "dtoverlay=pi3-disable-bt" >>/boot/config.txt'
  29. sudo systemctl disable hciuart >/dev/null
  30. sleep 1
  31. fi
  32. if ! grep "consoleblank=0" /boot/cmdline.txt >/dev/null
  33. then
  34. sudo bash -c 'sed -i -e "s/rootwait/rootwait consoleblank=0/g" /boot/cmdline.txt'
  35. fi
  36. if grep "console=serial0,115200" /boot/cmdline.txt >/dev/null
  37. then
  38. sudo bash -c 'sed -i -e "s/console=serial0,115200//g" /boot/cmdline.txt'
  39. fi
  40. echo "Done"
  41. fi