LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Blogs > lazydog
User Name
Password

Notices


Rate this Entry

Gentoo Upgrade Script

Posted 07-27-2017 at 08:00 PM by lazydog
Updated 08-23-2017 at 03:41 PM by lazydog

This is a script I put together to update my system. I know a lot of people like to run a script and it do everything but I like to get user input to ensure the next step you really want to complete.

I'm sure there are easier way of doing some of the things and I have built in precautions to hopefully keep you from making a mistake.


I've made some minor adjustments to the script by adding color and looking for input to be one or the other.
Here is the new script.
Code:
#/bin/bash

function jumpto
{
    label=$1
    cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
    eval "$cmd"
    exit
}

clear

# *** PORTAGE TREE UPDATE ***
echo
echo
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  UPDATING PORTAGE TREE'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo
echo
eix-sync && \
echo
echo

# *** SECURITY ADVISORIES ***
echo
echo
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  SECURITY ADVISORIES'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo
echo
glsa-check -l && \
echo
echo

# *** CONTINUE SYSTEM UPDATE***
input:
read -p $'\e[37;1mContinue with System Updates? [\e[32;1mYes\e[37;1m\\\e[31;1mNo\e[37;1m]\e[0m ' check

if [ "$check" != "y" ] && [ "$check" != "n" ]
        then jumpto input
fi

if [ "$check" == "n" ]
   then

        echo
        echo
        echo $'\e[37;1mThe folowing tasks were not completed\e[0m '
        echo
        echo $'    \e[33;1mSystem World Updates\e[0m '
        echo $'    \e[33;1mOutdated Package Removal\e[0m '
        echo $'    \e[33;1mETC File Updates\e[0m '
        echo
        echo
        echo $'\e[32;1m*******************************'
        echo '*******************************'
        echo '**'
        echo '**  SYSTEM UPDATE COMPLETE'
        echo '**'
        echo '*******************************'
        echo $'*******************************\e[0m'
        echo
        echo
        exit
fi

# *** SYSTEM UPDATE ***
echo
echo
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  CHECKING SYSTEM UPDATES'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo
echo
emerge --ask --update --deep --with-bdeps=y @world && \
echo
echo

# *** REMOVE OLD PACKAGES
echo
echo
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  REMOVING OLD PACKAGES'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo
echo
emerge --ask --depclean && \
echo
echo

# *** UPDATING ETC FILES
echo
echo
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  UPDATING ETC FILES'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo
echo
etc-update && \
echo
echo

echo
echo 
echo $'\e[32;1m*******************************'
echo '*******************************'
echo '**'
echo '**  SYSTEM UPDATE COMPLETE'
echo '**'
echo '*******************************'
echo $'*******************************\e[0m'
echo 
echo
Posted in Uncategorized
Views 670 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration