#!/bin/bash #Copyright 2002 William Stearns #Released under the GPL. POMListVer='0.1.4' echo pomlist \(Patch-o-matic\) file lister, version $POMListVer. >>/dev/stderr fail () { echo "$* Exiting." >>/dev/stderr exit 1 } usage () { echo 'pomlist, the patch-o-matic file html formatter, version '$POMListVer' .' >>/dev/stderr echo 'Usage: ' >>/dev/stderr echo ' pomlist [/path/to/p-o-m/directory] [fullpage] [http://baseurl/for/browsing]' >>/dev/stderr echo >>/dev/stderr echo 'The p-o-m directory is the directory containing "runme"' >>/dev/stderr echo 'If missing, it defaults to the current directory ' >>/dev/stderr echo '"fullpage" tells pomlist to construct the entire html page, ' >>/dev/stderr echo 'as opposed to the default html body text.' >>/dev/stderr echo 'The optional URL base is one that will be used in the hypertext ' >>/dev/stderr echo 'links to the actual files if specified. Otherwise, links to the ' >>/dev/stderr echo 'local files will be used.' >>/dev/stderr echo >>/dev/stderr echo 'Examples: ' >>/dev/stderr echo ' pomlist /usr/src/iptables-1.2.6a/patch-o-matic fullpage >pom-output.html' >>/dev/stderr echo ' pomlist /usr/src/iptables-1.2.6a/patch-o-matic fullpage | lynx -stdin' >>/dev/stderr echo ' pomlist /usr/src/iptables-1.2.6a/patch-o-matic fullpage http://cvs.samba.org/cgi-bin/cvsweb/~checkout~/netfilter/userspace/patch-o-matic/ >pom-output.html' >>/dev/stderr echo ' pomlist /usr/src/iptables-1.2.6a/patch-o-matic fullpage file:/usr/src/iptables-1.2.6a/patch-o-matic/ >pom-output.html' >>/dev/stderr exit 0 } FullParams="$0 $*" POMDir='./' #Default if not specified while [ -n "$1" ]; do case "$1" in [Hh][Ee][Ll][Pp]) usage ;; [Ff][Uu][Ll][Ll][Pp][Aa][Gg][Ee]) Fullpage="yes" ;; [Hh][Tt][Tt][Pp]*|[Ff][Tt][Pp]*|[Ff][Ii][Ll][Ee]*) BaseURL="$1" ;; *) POMDir="$1/" ;; esac shift done #BaseURL="file:`pwd`/" [ -n "$BaseURL" ] || BaseURL="http://cvs.samba.org/cgi-bin/cvsweb/~checkout~/netfilter/userspace/patch-o-matic/" [ -e "$POMDir/runme" ] || fail 'Not in the patch-o-matic directory, please specify the directory that contains "runme" on the command line.' cd $POMDir || fail 'Could not change to patch-o-matic directory' if [ "$Fullpage" = "yes" ]; then cat < Patch-o-matic patch listing EOHEADER fi echo '' echo '' echo '' echo '' echo '

Patch listing

' #It isn't quite the case that all uppercase modules are targets, all #lower are matches. We'll just do a raw list. #Besides, bash on my system isn't letting me list or case upper vs. lower correctly. *sigh* echo '

ipv4 patches

' for OnePatch in `ls -A1 */*.patch.help 2>/dev/null | sed -e 's@.*/@@' | sort` ; do PatchName=`echo $OnePatch | sed -e 's/.patch.help//' -e 's/.patch.ipv6.help//'` echo -n '['$PatchName'] ' done echo echo '

ipv6 patches

' for OnePatch in `ls -A1 */*.patch.ipv6.help 2>/dev/null | sed -e 's@.*/@@' | sort` ; do PatchName=`echo $OnePatch | sed -e 's/.patch.help//' -e 's/.patch.ipv6.help//'` echo -n '['$PatchName'] ' done echo echo '
' for OneDir in * ; do if [ -d $OneDir ] && [ "$OneDir" != "CVS" ]; then echo '

'$OneDir'

' echo -n '[Top] ' for DirLink in * ; do if [ -d $DirLink ] && [ "$DirLink" != "CVS" ]; then if [ "$DirLink" != "$OneDir" ]; then echo '['$DirLink'] ' else echo '['$DirLink'] ' fi fi done if [ -e "$OneDir/SUITE" ]; then Suite=`cat $OneDir/SUITE | sed -e "s/$OneDir//" | grep -v '^\W*$'` if [ -n "$Suite" ]; then echo '

'$OneDir' depends on: '$Suite'

' fi fi cd $OneDir if [ -f DESCRIPTION ]; then echo -n '

' cat DESCRIPTION echo '

' fi echo '
' echo '
' for OnePatch in `ls *.patch.help *.patch.ipv6.help 2>/dev/null` ; do PatchName=`basename $OnePatch | sed -e 's/.patch.help//' -e 's/.patch.ipv6.help//'` echo -n '
'$PatchName' ' for OneExt in patch patch.config.in \ patch.configure.help patch.help patch.ipv6 \ patch.ipv6.config.in patch.ipv6.configure.help \ patch.ipv6.help patch.ipv6.makefile patch.makefile ; do if [ -f $PatchName.$OneExt ]; then #FIXME urlbase echo -n '['$PatchName.$OneExt'] ' fi done echo echo '
' echo '
'
			cat $OnePatch | sed \
			 -e 's@\(Author.*\)<\([^\>]*\)>@\1\<\2\>@' \
			 -e 's@\(http:[^ ]*\)@\1@' \
			 -e 's@\(ftp:[^ ]*\)@\1@'
			echo '
' echo '
' done echo '
' cd .. fi done echo '
' echo '

Generated '`date`' by pomlist version '$POMListVer'.

' echo '
' if [ "$Fullpage" = "yes" ]; then cat < EOFOOTER fi