Advertisement
Bluestrings

ES01

Jan 10th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.92 KB | None | 0 0
  1. #!/bin/bash
  2. echo
  3. sudo apt-get update
  4. echo
  5. echo '--------------------------------------------------------------------------------'
  6. echo '--------------------------------------------------------------------------------'
  7. echo
  8. sudo apt-get -y -q upgrade
  9. sudo rpi-update
  10.  
  11. #sudo apt-get -y -q dist-upgrade
  12. #In Raspbian Wheezy a sudo apt-get update & dist-upgrade is sufficient.
  13. #https://www.raspberrypi.org/forums/viewtopic.php?t=40553
  14. #https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade
  15. #   sudo rpi-update
  16. #   Using rpi-update is no longer recommended as it installs a Testing Kernel.
  17. #   https://www.raspberrypi.org/forums/viewtopic.php?t=40553
  18.  
  19. echo '--------------------------------------------------------------------------------'
  20. echo '--------------------------------------------------------------------------------'
  21. echo
  22. echo "Making backup of config.txt before making changes."
  23. echo
  24. sudo cp /boot/config.txt /boot/config.txt.bak
  25. echo
  26. if grep -Fxq "gpu_mem = 32" /boot/config.txt ; then
  27.   echo 'Using 32 MB of GPU Memory. No changes will be made.'
  28.   echo "gpu_mem = 32" > /home/pi/Public/gpu_mem_temporary.txt
  29. elif grep -Fxq "gpu_mem = 64" /boot/config.txt ; then
  30.   echo 'Using 64 MB of GPU Memory currently, setting to 32 MB temporarily.'
  31.   echo "gpu_mem = 64" > /home/pi/Public/gpu_mem_temporary.txt
  32.   sudo sed -i '/gpu_mem = 64/ c\gpu_mem = 32' /boot/config.txt
  33. elif grep -Fxq "gpu_mem = 128" /boot/config.txt ; then
  34.   echo 'Using 128 MB of GPU Memory currently, setting to 32 MB temporarily.'
  35.   echo "gpu_mem = 128" > /home/pi/Public/gpu_mem_temporary.txt
  36.   sudo sed -i '/gpu_mem = 128/ c\gpu_mem = 32' /boot/config.txt
  37. elif grep -Fxq "gpu_mem = 256" /boot/config.txt ; then
  38.   echo 'Using 256 MB of GPU Memory currently, setting to 32 MB temporarily.'
  39.   echo "gpu_mem = 256" > /home/pi/Public/gpu_mem_temporary.txt
  40.   sudo sed -i '/gpu_mem = 256/ c\gpu_mem = 32' /boot/config.txt
  41. else
  42.   echo 'No value found, assuming using default 64 MB of GPU Memory'
  43.   echo 'for the Raspberry Pi 3. Setting to 32 MB temporarily.'
  44.   echo "gpu_mem = 64 - value not found" > /home/pi/Public/gpu_mem_temporary.txt
  45.   sudo sh -c "echo 'gpu_mem = 32' >> /boot/config.txt"
  46. fi
  47.  
  48. # add or replace "gpu_mem = 32"
  49. # if you skip this step, you will probably get "out of memory" errors when compiling
  50. # Instructions --> http://www.emulationstation.org/gettingstarted.html#install_rpi_standalone
  51. echo '--------------------------------------------------------------------------------'
  52. echo '--------------------------------------------------------------------------------'
  53. echo
  54. echo 'Part 1 completed, reboot and additional script to run automatically.'
  55. echo 'Reboot to occur in 30 seconds. After part 2 is completed, your Pi'
  56. echo 'will reboot again. It creates a script noted below that will not'
  57. echo 'be automatically deleted. You may delete this after the second'
  58. echo 'reboot occurs.'
  59. echo
  60.  
  61. sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement