nixers
[FreeBSD] Update script - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Operating Systems & Administration (https://nixers.net/Forum-Operating-Systems-Administration)
+--- Forum: BSD (https://nixers.net/Forum-BSD)
+--- Thread: [FreeBSD] Update script (/Thread-FreeBSD-Update-script)


[FreeBSD] Update script - yrmt - 22-07-2012

This little script can be useful and is has colors ! :P


Code:
#!/bin/sh
# Author: Beastie
# FreeBSD update script with colors !
# dependencies : portmaster and portaudit,
# can be found in /usr/ports/ports-mgmt.

# log file
LOG_FILE="/var/log/freebsd-update.log"

# colors
BOLD_S="\033[1m";    
BOLD_E="\033[0m"
CYAN_S="\e[1;36m";    
CYAN_E="\e[1;36m\e[0m"
GREEN_S="\e[0;32m";    
GREEN_E="\e[1;32m\e[0m"
YELLOW_S="\e[1;33m";    
YELLOW_E="\e[1;33m\e[0m"
RED_S="\e[0;31m";    
RED_E="\e[1;31m\e[0m"
MAGENTA_S="\e[1;35m";    
MAGENTA_E="\e[1;35m\e[0m"

echo -e "${RED_S}Starting updates: \e[0m `date`\n" | tee -a ${LOG_FILE}
echo -e "${YELLOW_S}***\n"
echo -e "${RED_S}*** Checking for FreeBSD patches...\n"
echo "***"
/usr/sbin/freebsd-update fetch | tee -a ${LOG_FILE}
/usr/sbin/freebsd-update install | tee -a ${LOG_FILE}

echo -e "${GREEN_S}***\n"
echo -e "${YELLOW_S}*** Updating ports tree...\n"
echo -e "${RED_S}***\n"
/usr/sbin/portsnap fetch update | tee -a ${LOG_FILE}

echo -e "${GREEN_S}***\n"
echo -e "${YELLOW_S}*** Looking for ports to update...\n"
echo -e "${RED_S}***\n"
/usr/local/sbin/portmaster -a --no-confirm | tee -a ${LOG_FILE}

echo -e "${GREEN_S}***\n"
echo -e "${YELLOW_S}*** Checking installed ports for known security problems...\n"
echo -e "${RED_S}***\n"
/usr/local/sbin/portaudit -Fva | tee -a ${LOG_FILE}
echo -e "Finished updates: \e[0m `date`" | tee -a ${LOG_FILE}



RE: [FreeBSD] Update script. - Saos - 25-07-2012

Used this several times. Awesome.


RE: [FreeBSD] Update script. - Amzo - 25-07-2012

what about entries in pkg_updating? Should add error checking for it.


RE: [FreeBSD] Update script. - yrmt - 25-07-2012

(25-07-2012, 05:00 PM)Amzo Wrote: what about entries in pkg_updating? Should add error checking for it.

Well I assume people read it before updating but I can make it print if ports are checking and prompt to do the updates or not.


RE: [FreeBSD] Update script. - yrmt - 06-06-2013

Using this script for the first time in like 10 month. Pretty useful!


RE: [FreeBSD] Update script - berk - 06-07-2013

Used this script today. Legit. Great script, thanks yrmt.


RE: [FreeBSD] Update script - Mafia - 06-07-2013

Thanks Brosiff.


RE: [FreeBSD] Update script - Robby - 07-07-2013

I very rarely check for updates and usually don't bother with the ports tree after the box install. I should probably start using this on a monthly basis or something. By the way are you Beastie? Just noticed from the top of the script and the alternate thread author.


RE: [FreeBSD] Update script - yrmt - 07-07-2013

Yes I'm beastie :)


RE: [FreeBSD] Update script - yrmt - 08-07-2013

Or he could post more on the forums.


RE: [FreeBSD] Update script - Robby - 08-07-2013

I'm on the IRC right now, I will try to come on the forums more. All I seem to do these days is play music and research for my college coursework. I'm currently compiling the FreeBSD world for the playstation on powerpc so we can get our spare OtherOS++ enabled playstation to dualboot FreeBSD and GameOS.


RE: [FreeBSD] Update script - FreeBSD - 08-07-2013

Wow thanks! This is quite useful and appreciated.