May 24, 2009

Gentoo Easy Upgrade Script

If you just followed my previous blog about Gentoo you'll probably trying to understand what "easy upgrade" is for me and what I've to do for maintaining my system up to date.

If you take a look at the Gentoo Handbook you'll see how you can install and upgrade your system, expecially read Gentoo Upgrading Guide for making these tasks.

Syncing Gentoo portage is basically like the BSD upgrade, for a quick upgrade I've just made a script few years ago with the same commands listed in Upgrade guide, please feel free to contribute or mail me for corrections on the script.

But before the script it's important to understand the golden rule: read what your computer is writing to you, I think it should be applied to everything but expecially read what is saying, that's why I've placed a pause after each command; for example if you need to upgrade portage because it's telling you so then you've to do this so interrupt the script and upgrade portage, then re-run the script again from the step you're.

Comments and suggestions are welcomed:

#!/bin/bash
keypress() {
echo -n "hit any key to continue..."
read -n1 -e -r 2> /dev/null
echo
}

clear
echo "System Upgrade Script"
echo "--------------------------------------------------------------------------------"
echo
echo -n -e "portage sync ? ([y]/n) "
read key -n1 -e -r 2> /dev/null
if [ "$key" == "n" ]; then
echo
else
echo "Portage Sync"
emerge --sync
fi

echo
echo "Complete system upgrade (emerge --update --deep --newuse world)"
keypress
START=`date`
emerge --update --deep --newuse world
STOP=`date`
echo "Start : "$START
echo "End : "$STOP

echo
echo "Configuration files upgrade (etc-update)"
keypress
etc-update

echo
echo "Dependencies Clean (emerge --depclean)"
keypress
emerge --depclean

echo
echo "Dependencies Check and Rebuild (revdep-rebuild)"
keypress
revdep-rebuild

echo
echo
echo
echo "--------------------------------------------------------------------------------"
echo " System Upgrade Completed"
echo "--------------------------------------------------------------------------------"
echo
echo

RSync connection to gentoo hosts is maded only if you need it,  if you need to upgrade your system just make it once a day, it doesn't make sense to flood gentoo servers with rsync requests, and of course you'll be banned if you do so

Hope it helps

Any hints ?

Click Here!