Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A script to manage networked software updates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to manage networked software updates
Authored by: jmao on Apr 17, '04 08:54:37AM

We have a controlled image,...and a ton of laptops, I made a start up item that pulls down packages that I place on a local server. When the system boots, it checks for packages. If it finds one it doesn't have, it downloads and installs it. Since I know exactly what is on the laptops, we can place our Apple updates or any other custom package on the server. Packages are installed in order as they are listed in the text file that is curl-ed first. Installs that need a reboot are not active until the next install, but since we have over 600 student laptops, this works fine for us,....


. /etc/rc.common

#This script is a low-tech software update setup.
#To prepare a script for the server:
#sudo tar -czvf filename.pkg.tar.gz filename.pkg

ConsoleMessage "Updating Computer"

#Get date
TODAY=`/bin/date +%m-%d-%y`

#Check to see if directory exist, if not make it
if ( ! test -d /usr/local/myupdate ) then
mkdir /usr/local/myupdate

cd /usr/local/myupdate

#curl packages list from http server
curl -Os http://ipaddress/path/to/directory

#for each item in updates list, go get it
for listitem in `cat updates`; do

#set variables
downloadname=`echo $listitem | cut -f1 -d:`
pkgname=`echo $listitem | cut -f1 -d:| sed -e 's/.tar.gz//'`
receiptname=`echo $listitem | cut -f2 -d:`

#if package receipt does not exist, then get package and install it
if (! test -d /Library/Receipts/$receiptname) then
curl -sO http://ipaddress/path/to/directory/$downloadname
tar -xzf $downloadname
rm $downloadname
installer -verbose -pkg $pkgname -target / >&log_$pkgname-$TODAY.txt
rm -R $pkgname


[ Reply to This | # ]