File: [local] / www / Attic / portstat.bld (download)
Revision 1.3, Wed Oct 7 21:15:46 1998 UTC (25 years, 7 months ago) by marc
Branch: MAIN
Changes since 1.2: +9 -4 lines
update port status; include one line comment with port name
(suggested by ian@); update script that builds port status page
to include the port's comment
|
#! /bin/sh
#
# $OpenBSD: portstat.bld,v 1.3 1998/10/07 21:15:46 marc Exp $
#
# Build the OpenBSD port status web page.
# Uses the following files:
#
# portstat.hdr: <html>, <head> and the start of <body>
# portstat.tlr: contact info, </body>, </html>
# portstat.stat: The name, date of last change, and status
# of each port.
#
#set -e
prog=`basename $0`
tmp=`mktemp /tmp/$prog-$$-XXXXXXXXXX`
work=`mktemp $prog-$$-XXXXXXXXXX`
trap "rm -f $work $tmp; exit 1" 0 1 2 3 15
if [ ! -f portstat.hdr ]; then
echo "$prog: missing file portstat.hdr"
exit 1
fi
if [ ! -f portstat.tlr ]; then
echo "$prog: missing file portstat.tlr"
exit 1
fi
if [ ! -f portstat.stat ]; then
echo "$prog: missing file portstat.stat"
exit 1
fi
# Start with the boilerplate header
#
cat portstat.hdr > $work
# Build the table of contents
#
echo " <p>Select from the following list of categories:" >> $work
echo " <dir compact>" >> $work
for f in /usr/ports/*; do
n=`basename $f`
if [ -d $f -a $n != CVS -a $n != distfiles ]; then
echo " <li><a href=#$n>$n</a>" >> $work
fi
done
echo " </dir>" >> $work
# Now process each category
#
for f in /usr/ports/*; do
n=`basename $f`
if [ -d $f -a $n != CVS -a $n != distfiles ]; then
# build the category header
#
echo " <hr>" >> $work
echo " <a name=$n></a>" >> $work
echo " <h3><font color=#0000e0>$n</font></h3>" >> $work
echo " <pre>" >> $work
# Process the ports within this category
#
for d in $f/*; do
dd=`basename $d`
if [ -d $d -a $dd != CVS ]; then
cmt=`cat $d/pkg/COMMENT`
sed -n -e "/^$dd\$/,/^\$/p" portstat.stat > $tmp
info=`sed -e "s|^$dd|$dd - $cmt|" $tmp`
if [ "$info" ]; then
echo " $info" >> $work
else
echo " $dd" >> $work
echo "no status for $dd" >&2
fi
echo "" >> $work
fi
done
# add in the category trailer
#
echo " </pre>" >> $work
echo " <p align=center><a href=#top>return to top of page</a>" >> $work
fi
done
# Add in the trailer
#
cat portstat.tlr >> $work
# Save any existing file then make the work file the current portstat.html.
#
if [ -f portstat.html ]; then
if [ -f portstat.html- ]; then
rm portstat.html-
fi
mv portstat.html portstat.html-
fi
mv $work portstat.html
# that's all
#
exit 0