May 27, '11 07:30:00AM • Contributed by: Anonymous
This 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.
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
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.]
