10.6: A script to display available Apple software updates

May 27, '11 07:30:00AM

Contributed by: Anonymous

Snow Leopard only hintThis is a script that is supposed to be used with GeekTool if you are running as a non-admin user (as I am) and thus no longer get to see when new software is available from Apple.

I grew tired of being a good user and not run as admin anymore, but then not getting info about new software from Apple. Therefore I wrote 'SoftwareUpdateCheck.sh,' a bash-script that gathers info from the command-line utility 'softwareupdate' and presents it.

In short:

You can find all about it the options and functionality of the script here. You should read up on it a bit before proceeding with the installation.

Here is the install script:
#!/bin/bash
# Program fˆr att installera SoftUpdCheck.sh
# 2011-04-26 / Peter Mˆller, Datavetenskap, LTH
# 2011-05-05: checksum-check
# Location: 
# http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/SoftUpdCheck_install.sh

# Kolla s att anv‰ndaren ‰r "root"
if [ ! "$USER" = "root" ] ; then
  echo "Must be run by root!"
  echo "Exiting..."
  exit 1
fi

# H‰mta och starta launchd-komponenten
echo "Fetching launchd-component"
curl -o /Library/LaunchDaemons/se.lth.cs.softwareupdatecheck.plist http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/se.lth.cs.softwareupdatecheck.plist
chmod 644 /Library/LaunchDaemons/se.lth.cs.softwareupdatecheck.plist
launchctl load /Library/LaunchDaemons/se.lth.cs.softwareupdatecheck.plist
launchctl start se.lth.cs.softwareupdatecheck
echo
echo

# H‰mta scriptet
echo "Fetching main script"
ScriptName="SoftwareUpdateCheck.sh"
curl -o /tmp/${ScriptName} http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/${ScriptName}
curl -o /tmp/${ScriptName}.sha1 http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/${ScriptName}.sha1
if [ "$(openssl sha1 /tmp/${ScriptName} | awk '{ print $2 }')" = "$(less /tmp/${ScriptName}.sha1)" ]; then
  mv /tmp/${ScriptName} /usr/bin/${ScriptName}
  chmod 755 /usr/bin/${ScriptName}
else
  echo "Checksum does NOT match!! Installation aborted!"
  exit 1
fi
echo
echo

echo "Done installing base parts of \"SoftUpdCheck.sh\"."
echo

if [ -z "`ls /Library/PreferencePanes/GeekTool.prefPane 2> /dev/null`" -a -z "`ls /Users/*/Library/PreferencePanes/GeekTool.prefPane 2> /dev/null`" ]; then
  echo "Fetching GeekTool"
  # ÷ppna webbsidan fˆr att h‰mta ner GeekTook
  #open http://projects.tynsoe.org/en/geektool/download.php
  curl -o /tmp/GeekTool.dmg http://update.tynsoe.org/geektool3/Public/GeekTool%203.0.dmg
  hdiutil mount /tmp/GeekTool.dmg
  open /Volumes/GeekTool\ 3/
  echo "GeekTool fetched: You will have to install it yourself, though."
  say "Done installing base parts of software update check. Now you will have to install GeekTool yourself"
fi

exit 0
Since 'softwareupdate' must be run by root, you will have to be an admin and use sudo when you run this script.

Installation
[crarko adds: I haven't tested this one.]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110519082623257