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

Click here to return to the 'A script to install all required Software Updates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to install all required Software Updates
Authored by: gracoat on Oct 09, '08 10:14:32AM

It's an excellent script. Granted a bit on unix knowledge goes a long way in understanding what's going on with this.
I teach at a high school full of macs, and was looking for a nice way to update all the macs.

The system I have is such that my students cannot update the system, and thus the 'Software Update' window won't pop up for them. This means that I have to log in as an administrator to do so. Not only that, but my OD server has the software update server set up.

SO... This means that while the script works well, I have to poke at it to get it to look at my server instead up at Apple for updates.

Anyways... A quick explanation as to how this all works...

One user posted that they were concerned that writing over the default setting, leaving the message on your screen...
The first part of the first if statement looks for the existence of a file called /Users/Shared/.iniswupd_inprog
If it finds it it runs the updates.
When it's done updating the actual Software Update program actually runs again automatically... Behind the scenes in the console, Software update returns messages stating what it's found. This script looks for that using the "if [ `softwareupdate -l | wc -l` -le 3 ]"
Interestingly... the software update program when it finds nothing to update, it outputs 3 lines of code. Note in the text:

<b>`softwareupdate -l</b> --> this tells the computer to 'look at' the console output for anything softwareupdate. <b>| wc -l` -le 3]</b> -->the pipe then passes the info to the wc (word count) program with the modifier -l (<i>count lines instead of words</i>)

Lastly the program cleans up. The notable one is the delete from the loginwindow preference the Loginwindowtext line.

The rest of the script complex, but in plain english:

After looking to see if there's a file called .initswupd_inprog in the shared folder, and NOT finding one, it'll create one.
Then it adds the line of text to the login window screen.
Then it figures out which OS you're using so that it's able to give the right command as far as how to execute the update process.
Then it restarts! (wash-rinse-repeat) until there's no more updates.

**If you still have the text on your login window even if there's no more updates, then for whatever reason the defaults didn't reset. You can do so by stealing a line of text right from this script and typing it directly in the terminal.
You should do this as root user by the way.
Type the following in terminal:
defaults delete /Library/Preferences/ LoginwindowText

Hope this makes things less muddy!

[ Reply to This | # ]