+#!/bin/sh
+#
+# Gnucomo package parameter report.
+#
+# Create a list of packages and patches on a Solaris system
+# that can be read by the Gnucomo input program, gcm_input.
+#
+
+
+HOST=`hostname`
+TIME=`date`
+FILTER=/usr/local/bin/pkg-solaris.awk
+
+echo "<?xml version='1.0'?>"
+echo "<gcmt:message xmlns:gcmt='http://gnucomo.org/transport/'>"
+echo " <gcmt:header>"
+echo " <gcmt:messagetype>package list</gcmt:messagetype>"
+echo " <gcmt:hostname>$HOST</gcmt:hostname>"
+echo " <gcmt:time>$TIME</gcmt:time>"
+echo " </gcmt:header>"
+echo " <gcmt:data>"
+
+echo " <gcmt:parameters gcmt:class='package'>"
+
+pkginfo -l|awk -f $FILTER |sed -e 's/&/&/'
+
+showrev -p | cut -f2 "-d " |sort| tr '-' ' ' > /tmp/patchlist.$$
+read PREV_PATCH PREV_VERSION < /tmp/patchlist.$$
+
+while read PATCH VERSION
+do
+ if [ $PREV_PATCH = $PATCH ]
+ then
+ PREV_VERSION=$VERSION
+ else
+ echo "<gcmt:parameter name='$PREV_PATCH'>"
+ echo " <gcmt:description>Solaris patch $PREV_PATCH</gcmt:description>"
+ echo " <gcmt:property name='version'>$PREV_VERSION</gcmt:property>"
+ echo "</gcmt:parameter>"
+ fi
+ PREV_PATCH=$PATCH
+ PREV_VERSION=$VERSION
+done < /tmp/patchlist.$$
+
+tail -1 /tmp/patchlist.$$ >/tmp/patchtail.$$
+read PATCH VERSION </tmp/patchtail.$$
+echo "<gcmt:parameter name='$PATCH'>"
+echo " <gcmt:description>Solaris patch $PATCH</gcmt:description>"
+echo " <gcmt:property name='version'>$VERSION</gcmt:property>"
+echo "</gcmt:parameter>"
+
+echo " </gcmt:parameters>"
+echo " </gcmt:data>"
+echo "</gcmt:message>"
+
+rm /tmp/patchlist.$$
+rm /tmp/patchtail.$$
+