Sunday, February 21, 2016

Raspberry Pi - Update Raspberry Pi Script

While searching, I found a great little post on cagewebdev.com for quickly running your Raspberry Pi through all of its updates. The original post is here.

My only modification is I created the script in the logon user's /home directory instead of putting in a separate Code directory due to to single use of my Pis currently. While it may be ultimately a bad practice to not properly put all scripts into a dedicated directory, it provides the current ease of access that I desire.

Here is the process:
Create the shell script:
nano updatepi.sh
Copy/Paste(click) or manually type the following into the Nano screen:
#!/bin/bash
date
echo UPDATING SYSTEM SOFTWARE – UPDATE
sudo apt-get update
echo UPDATING SYSTEM SOFTWARE – UPGRADE
sudo apt-get upgrade -y
echo UPDATING SYSTEM SOFTWARE – DISTRIBUTION
sudo apt-get dist-upgrade
echo REMOVING APPLICATION ORPHANS
sudo apt-get autoremove –y
echo UPDATING FIRMWARE
sudo rpi-update
 Once complete, Save (Ctrl+X, then Enter) and exit (Ctrl+X).

Now, we need to make the script executable:
sudo chmod +x updatepi.sh
 Lastly, lets run the script:
sudo ./updatepi.sh
Depending on what updates are needed, you may be prompted to enter Y or N to continue the process. If a firmware update is installed, you may also require a reboot to make the change.
To restart immediately, run:
sudo reboot  



No comments:

Post a Comment