Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 42 lines (37 sloc) 1.342 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#!/bin/bash
#
# Notify of MacPort updates via Growl on Mac OS X
#
# Author: Chris Streeter http://www.chrisstreeter.com
# Requires: Growl Notify Extra to be installed (but fails gracefully). Info
# about how to get the extra is at http://growl.info/extras.php


TERM_APP='/Applications/Terminal.app'
PORT_EXEC='/opt/local/bin/port'
GROWL_NOTIFY='/usr/local/bin/growlnotify'
GROWL_TITLE="MacPort Update(s) Available"
GROWL_ARGS="-n 'MacPorts' -d $GROWL_NOTIFY -a $PORT_EXEC"

$PORT_EXEC sync 2>&1 > /dev/null
outdated=`$PORT_EXEC outdated`

if echo $outdated | grep -q 'No installed ports are outdated.' ; then
if [ -e $GROWL_NOTIFY ]; then
        # No updates available
        $GROWL_NOTIFY $GROWL_ARGS -m '' -t "No MacPort Updates Available"
    fi
else
    # We've got an outdated port or two
    
    # Nofity via growl
    if [ -e $GROWL_NOTIFY ]; then
lc=$((`echo "$outdated" | wc -l` - 1))
        outdated=`echo "$outdated" | tail -$lc | cut -d " " -f 1`
        message=`echo "$outdated" | head -5`
        if [ "$outdated" != "$message" ]; then
message="Some of the outdated packages are:
$message"
        else
message="The following packages are outdated:
$message"
        fi
        # Send to growlnotify
        echo "$message" | $GROWL_NOTIFY $GROWL_ARGS -s -t $GROWL_TITLE
    fi
fi
Something went wrong with that request. Please try again.