lu.se

Datavetenskap

Lunds Tekniska Högskola

Denna sida på svenska This page in English

SoftwareUpdateCheck.sh

Image of SoftUpdCheck.sh running

About SoftwareUpdateCheck.sh

SoftwareUpdateCheck.sh list the software updates that may be fetched thorught “Software Update...”. Since the Adobe Flash-plugin has seen som many security issues for quite some time, there is an option, -f, that shows if there is a new Flash-plugin available.

Typical user of this script are all those who no longer is running their machines as an admin-user and thus no longer get the information about software updates (from Apple). Although you may run it in a Terminal-window, it's intended to be run together with GeekTool and display the output on the desktop.

The script checks for software updates every 6 houres and updates itself every two weeks. If open_ports.sh is running on the machine, SoftwareUpdateCheck.sh use the data generated by open_ports.sh. You typically have GeekTool run every 15 minutes.

If no updates are available, it looks like this:

Image of SoftUpdCheck.sh running

 

Use

Options:
-fShows the status of the Adobe Flash plugin
-uUpdate the scriptet. Since it's located in /usr/bin you need to be root to do this
-tForceful creation of data
-hHelp. Shows this text

 
Example from Terminal.app:
$ SoftwareUpdateCheck.sh
Hostname: paravel.cs.lth.se (130.235.16.211)    Running: Mac OS X 10.6.7    Uptime: 4 days

Software update check performed at: 9 Maj 10:31
No system software updates found


Installation

  1. Get the script from http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/SoftwareUpdateCheck_install.sh
  2. Start Terminal.app
  3. Become root: if you are an ordinary user, type su adminanvändarnamn and then sudo -i; if you are an admin-user just type sudo -i
  4. Set the access rights for the downloaded script:
    chmod 755 SoftwareUpdateCheck_install.sh
  5. Run the script:
    ./SoftwareUpdateCheck_install.sh
  6. Installation is usually quite quick. If you don't have GeekTool installed, it will be fetched as well. To install it, double-click it's .PrefPane
  7. In GeekTool: click the icon named “Shell” and drag it to an empty part of the desktop and make it the size you like.
  8. In the “Properties”-window, enter:
    • Command: SoftwareUpdateCheck.sh
    • Refresh every: 900 s
    • Change font and color as you like
  9. Close GeekTool

The script is now running and will automatically launch after a reboot!

 

Manual installation

Put SoftwareUpdateCheck.sh in /usr/bin and se.lth.cs.softwareupdatecheck.plist in /Library/LaunchDaemons.

The, start (as root) tha letter with launchctl:
launchctl load /Library/LaunchDaemons/se.lth.cs.softwareupdatecheck.plist
launchctl start se.lth.cs.softwareupdatecheck
(make sure the file is owned by root and has access rights 644)

 

Updating

The script will automatically update itself every two weeks (14 days) but you may do it manually as well:
as root in a terminal-shell, type:
SoftwareUpdateCheck.sh -u

It will then fetch the latest version of the script and install it (if it is different than the version you have installed – otherwise it will tell you).

Alternatively you may do this by yourself as root (make sure you have a working Internet connection, though):
curl fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/SoftwareUpdateCheck.sh > /usr/bin/SoftwareUpdateCheck.sh
chmod 755 /bin/SoftwareUpdateCheck.sh

 

Description of the components

/usr/bin:
SoftwareUpdateCheck.shThe script that is being used both to gather data and display them
/Library/LaunchDaemons:
se.lth.cs.softwareupdatecheck.plistControl-script for launchd; makes  open_ports.sh run every 900 second to gather data
/tmp:
swu.tempData file containing the available updates (from softwareupdate).
ExternIP.txtThe external IP-address of the computer