[FreeBSD] Update script - BSD

Users browsing this thread: 4 Guest(s)
yrmt
Grey Hair Nixers
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}
Saos
Long time nixers
Used this several times. Awesome.
Amzo
Members
what about entries in pkg_updating? Should add error checking for it.
yrmt
Grey Hair Nixers
(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.
yrmt
Grey Hair Nixers
Using this script for the first time in like 10 month. Pretty useful!
berk
Long time nixers
Used this script today. Legit. Great script, thanks yrmt.
Mafia
Long time nixers
Thanks Brosiff.
Robby
Long time nixers
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.
yrmt
Grey Hair Nixers
Yes I'm beastie :)
yrmt
Grey Hair Nixers
Or he could post more on the forums.
Robby
Long time nixers
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.
FreeBSD
Long time nixers
Wow thanks! This is quite useful and appreciated.
I do Byte