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

10.6: A script to display available Apple software updates System 10.6
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:
  • It checks the software update every six hours.
  • It updates the presentation every fifteen minutes.
  • The script checks for a new version of itself every two weeks and automatically updates itself.
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
  • Get the most current version of the script from here.
  • Start Terminal.app.
  • Become root: if you are an ordinary user, type su and then sudo -i; if you are alrea dyan admin user just type sudo -i.
  • Set the access rights for the downloaded script:
    chmod 755 SoftwareUpdateCheck_install.sh
  • Run the script:
    ./SoftwareUpdateCheck_install.sh
  • Installation is usually quite quick. If you don't have GeekTool installed, it will be fetched as well. To install it, double-click its .PrefPane.
  • In GeekTool: click the icon named 'Shell' and drag it to an empty part of the desktop and make it the size you like.
  • In the 'Properties' window, enter:
    Command: SoftwareUpdateCheck.sh
    Refresh every: 900 s
    Change font and color as you like
  • Close GeekTool

[crarko adds: I haven't tested this one.]
    •    
  • Currently 3.20 / 5
  You rated: 4 / 5 (5 votes cast)
 
[5,531 views]  

10.6: A script to display available Apple software updates | 6 comments | Create New Account
Click here to return to the '10.6: A script to display available Apple software updates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: A script to display available Apple software updates
Authored by: MVasilakis on May 27, '11 08:11:40AM

This would be great if it also checked versions of your installed apps in Applications & ~/Applications for newer versions.



[ Reply to This | # ]
10.6: A script to display available Apple software updates
Authored by: regulus on May 27, '11 08:24:00AM

While interesting, that's certainly a complicated process to check for software updates from the command line. Type this in the Terminal to check for updates:
softwareupdate -l

Type this to install the updates (this requires admin rights):
sudo softwareupdate -i -a

Obviously there's other options if you want to gain more control over which updates are installed but that's the basics. You can even run them on a remote machine if you ssh into it first.

---
Hank
http://www.hamsoftengineering.com



[ Reply to This | # ]
10.6: A script to display available Apple software updates
Authored by: _aeon on May 27, '11 08:56:07AM
Mac OS X Software Update Notifications for Non-Admin-Users:
http://blog.kaputtendorf.de/2009/02/22/updatecheck/

It works pretty well :)

[ Reply to This | # ]
10.6: A script to display available Apple software updates
Authored by: Michael_S on May 27, '11 07:20:25PM
Yup. As it is written and stored at that hallow place on the Internet:
Thou shalt study thy libraries and strive not to reinvent them without cause, that thy code may be short and readable and thy days pleasant and productive.
-- The Ten Commandments for C Programmers. By extension, applies to Unix utilities as well. That said, I didn't know about the command line utility either, and am glad about the comments here often bringing out such solutions.

[ Reply to This | # ]
Run as admin
Authored by: RMo on May 27, '11 07:45:51PM

Is it really a good idea not to run as admin? (OK, bad phrasing--it's never a bad idea. I really mean: is it a bad idea to run as admin?) Running as normal user instead of admin was certainly a good idea on pre-Vista versions of Windows--if you were an admin, you could do anything anywhere and nothing would even try to stop you (or an executable silently running as you).

However, on OS X and newer versions of Windows, you are prompted for your password (or, on Windows, at least just confirmation if you're already an admin) whenever you do anything that requires admin privileges--e.g., modifying anything in the file system besides your profile folder, changing system-wide settings (like power management or the computer's hostname), and the like. You're prompted even if your account currently is an administrator. Even from Terminal (in OS X) you have to sudo for certain commands (and in Windows you'll have to do the equivalent right-click-and-choose "Run as Administrator," even if you are one, when you start the command prompt, to give it that extra level of elevation).

I don't really see how it's different, other that running as a non-admin makes you think of the username, as well.



[ Reply to This | # ]
10.6: A script to display available Apple software updates
Authored by: merlyn on Jun 03, '11 05:27:32PM
Uh, what's wrong with running softwareupdate -l from the command line whenever you're curious?

[ Reply to This | # ]