File: [local] / www / Attic / portstat.bld (download)
Revision 1.1, Wed Mar 4 20:13:10 1998 UTC (26 years, 3 months ago) by marc
Branch: MAIN
add port status page. portstat.html is created by running portstat.bld.
the raw data comes from portstat.stat. Update ports.html to reference
the new page.
|
#! /bin/sh
#
# $OpenBSD: portstat.bld,v 1.1 1998/03/04 20:13:10 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`
work=$prog-$$
trap "rm -f $work; 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
info=`sed -n -e "/^$dd\\$/,/^\\$/p" portstat.stat`
if [ "$info" ]; then
echo " $info" >> $work
else
echo " $dd" >> $work
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