Showing Blastwave Packages with Upgrades Available

Posted by Sam

I love love love Blastwave. I couldn't imagine using Solaris without it. One of the annoying things though is if you want to see if newer packages are available you have to wade through every package that they have. And they have a lot. So here is a super simple one liner for showing just the packages that need to be upgraded.

pkg-get -c | grep -v "Not installed" | grep -v SAME | \
mailx -s "Blastwave Updates" yourname@example.com

And since you are probably using Solaris Zones here is a simple script that will look in all non-global zones and email out a report. Currently this sends one email per zone but that could easily be changed to send one email per physical box.

#!/usr/bin/sh

for zone in `/usr/sbin/zoneadm list | /usr/bin/grep -v global`; do
   zlogin $zone "/opt/csw/bin/pkg-get -c | \
   /usr/bin/grep -v \"Not installed\" | \
   /usr/bin/grep -v SAME | \
   /usr/bin/mailx -s \"Blastwave Updates for $zone\" yourname@example.com"
done

Tags: solaris blastwave opencsw

Comments

about 1 year later Philip said

FYI: pkg-get now has a built-in "-e" option (e for email), that should be suitable for easy dropping in a cronjob now :)

about 1 year later Sam said

Philip, It's an honor to have you comment on my humble blog! :) Unfortunately, I have to leave the script as it is. It's not all that impressive anyway and if I take away a piece there will be nothing left! ;)

Add a comment