Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo
- sudo apt-get update
- echo
- echo '--------------------------------------------------------------------------------'
- echo '--------------------------------------------------------------------------------'
- echo
- sudo apt-get -y -q upgrade
- sudo rpi-update
- #sudo apt-get -y -q dist-upgrade
- #In Raspbian Wheezy a sudo apt-get update & dist-upgrade is sufficient.
- #https://www.raspberrypi.org/forums/viewtopic.php?t=40553
- #https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade
- # sudo rpi-update
- # Using rpi-update is no longer recommended as it installs a Testing Kernel.
- # https://www.raspberrypi.org/forums/viewtopic.php?t=40553
- echo '--------------------------------------------------------------------------------'
- echo '--------------------------------------------------------------------------------'
- echo
- echo "Making backup of config.txt before making changes."
- echo
- sudo cp /boot/config.txt /boot/config.txt.bak
- echo
- if grep -Fxq "gpu_mem = 32" /boot/config.txt ; then
- echo 'Using 32 MB of GPU Memory. No changes will be made.'
- echo "gpu_mem = 32" > /home/pi/Public/gpu_mem_temporary.txt
- elif grep -Fxq "gpu_mem = 64" /boot/config.txt ; then
- echo 'Using 64 MB of GPU Memory currently, setting to 32 MB temporarily.'
- echo "gpu_mem = 64" > /home/pi/Public/gpu_mem_temporary.txt
- sudo sed -i '/gpu_mem = 64/ c\gpu_mem = 32' /boot/config.txt
- elif grep -Fxq "gpu_mem = 128" /boot/config.txt ; then
- echo 'Using 128 MB of GPU Memory currently, setting to 32 MB temporarily.'
- echo "gpu_mem = 128" > /home/pi/Public/gpu_mem_temporary.txt
- sudo sed -i '/gpu_mem = 128/ c\gpu_mem = 32' /boot/config.txt
- elif grep -Fxq "gpu_mem = 256" /boot/config.txt ; then
- echo 'Using 256 MB of GPU Memory currently, setting to 32 MB temporarily.'
- echo "gpu_mem = 256" > /home/pi/Public/gpu_mem_temporary.txt
- sudo sed -i '/gpu_mem = 256/ c\gpu_mem = 32' /boot/config.txt
- else
- echo 'No value found, assuming using default 64 MB of GPU Memory'
- echo 'for the Raspberry Pi 3. Setting to 32 MB temporarily.'
- echo "gpu_mem = 64 - value not found" > /home/pi/Public/gpu_mem_temporary.txt
- sudo sh -c "echo 'gpu_mem = 32' >> /boot/config.txt"
- fi
- # add or replace "gpu_mem = 32"
- # if you skip this step, you will probably get "out of memory" errors when compiling
- # Instructions --> http://www.emulationstation.org/gettingstarted.html#install_rpi_standalone
- echo '--------------------------------------------------------------------------------'
- echo '--------------------------------------------------------------------------------'
- echo
- echo 'Part 1 completed, reboot and additional script to run automatically.'
- echo 'Reboot to occur in 30 seconds. After part 2 is completed, your Pi'
- echo 'will reboot again. It creates a script noted below that will not'
- echo 'be automatically deleted. You may delete this after the second'
- echo 'reboot occurs.'
- echo
- sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement