#!/bin/bash #Copyright 2001, William Stearns #GPL'd. HtmlFileListVer="0.8" True=0 False=1 InList () { #Params: List, object to check if [ -n "`echo ' '$1' ' | grep ' '$2' '`" ]; then return $True else return $False fi } if [ "$1" = "fullpage" ]; then cat < `pwd | sed -e 's@.*/@@'` file listing EOHEADER fi if [ -f htmlfilelist-header.html ]; then cat htmlfilelist-header.html echo \ fi echo \ echo \\ \\\ Up one level\\\ \\\\\\ \\\ \\\ \ #FIXME doesn't handle files with spaces correctly; -e 's/^/"/' -e 's/$/"/' gives too many quotes to ls and -e 's/ /\\ /g' fails. for OneObj in `find | sed -e 's@\./@@' | grep -v '^\.$' | sort` ; do ObjName=`echo "$OneObj" | sed -e 's@.*/@@'` if echo "$OneObj" | grep -q '/' ; then ObjPath=`echo "$OneObj" | sed -e 's@\(.*\)/.*@\1@'` else ObjPath="." fi #echo X${ObjPath}X${ObjName}X >/dev/stderr if [ -d $OneObj ]; then echo \\ \\\ $OneObj\\\ \\\\\\ \ `ls -ald "$OneObj" | awk '{print $6,$7}'`\\ \ `ls -ald "$OneObj" | awk '{print $8}'`\\ \ #FIXME - do a case on *filelist.html, index. elif [ "$ObjName" = "htmlfilelist-header.html" ]; then : elif [ "$ObjName" = "htmlfilelist-footer.html" ]; then : elif [ "$ObjName" = "filelist.html" ]; then #Leave off size, date and timestamp for the currently-being-modified filelist.html echo \\ \\\ $OneObj\\\ \\\ \\\ \\\ \ elif [ "$ObjName" = "index.html" ] && [ $OneObj -ef $ObjPath/filelist.html ]; then #Same as above (only used if the exact same inode as filelist.html). echo \\ \\\ $OneObj\\\ \\\ \\\ \\\ \ else case "$ObjName" in #|*.thumb.ico|*.thumb.ICO not right now *.thumb.jpg|*.thumb.JPG|*.thumb.gif|*.thumb.GIF|*.thumb.xbm|*.thumb.XBM|*.thumb.png|*.thumb.PNG|*.thumb.pbm|*.thumb.PBM) : ;; #These should be caught by the image height test below, no need to special case anymore. #toc.gif|prev.gif|next.gif|first0.gif|first1.gif|index.gif|last0.gif|last1.gif|next0.gif|next1.gif|prev0.gif|prev1.gif|text.gif) # #Normal file, don't thumbnail these # echo \\ # \\\ $OneObj\\\ # \ `ls -ald "$OneObj" | awk '{print $5}'`\\ # \ `ls -ald "$OneObj" | awk '{print $6,$7}'`\\ # \ `ls -ald "$OneObj" | awk '{print $8}'`\\ # \ # ;; #|*.ico|*.ICO not right now *.jpg|*.JPG|*.gif|*.GIF|*.xbm|*.XBM|*.png|*.PNG|*.pbm|*.PBM) Images="$Images $ObjPath/$ObjName" echo \\ \\\ $OneObj\\\ \ `ls -ald "$OneObj" | awk '{print $5}'`\\ \ `ls -ald "$OneObj" | awk '{print $6,$7}'`\\ \ `ls -ald "$OneObj" | awk '{print $8}'`\\ \ ;; *) #Normal file echo \\ \\\ $OneObj\\\ \ `ls -ald "$OneObj" | awk '{print $5}'`\\ \ `ls -ald "$OneObj" | awk '{print $6,$7}'`\\ \ `ls -ald "$OneObj" | awk '{print $8}'`\\ \ ;; esac fi done echo \ if [ -n "$Images" ]; then #[wstearns@sparrow icons]$ identify mason_logo-50.gif | less #mason_logo-50.gif GIF 178x56+0+0 PseudoClass 256c 8-bit 4291b 0.0u 0:01 #width x height echo \ for OneImage in $Images ; do #-e 's/.*ICO //' not right now ImageHeight=`identify $OneImage | \ sed -e 's/.*GIF //' -e 's/.*JPEG //' -e 's/.*XBM //' -e 's/.*PNG //' -e 's/.*PNM //' \ -e 's/=>.*//' -e s'/ .*//' -e 's/.*x//' -e 's/\+.*//' | tail -1` Thumbnail=`echo $OneImage | sed -e 's/\(\.[gijpxGIJPX][[bcinpBCINP][fgmoFGMO]\)$/.thumb\1/'` case $ImageHeight in [0-9]|[0-9][0-9]|100) rm -f $Thumbnail echo \\\ ;; *) if [ ! -f "$Thumbnail" ]; then convert -geometry 100x100 $OneImage $Thumbnail fi echo \\\ ;; esac done fi for OneFile in README* ; do if [ -f $OneFile ] && [ -s $OneFile ]; then echo \ echo \$OneFile\ case $OneFile in *.html|*.htm|*.HTML|*.HTM) cat $OneFile | grep -v '' | grep -v '' | \ grep -v '' | grep -v '' | \ grep -v '' | grep -v '' | \ grep -v '' | grep -v '' ;; *) echo \ cat $OneFile | sed -e 's/<\([^@]*@[^>]*\)>/\<\1\><\/a>/g' echo \ ;; esac fi done ViewedRpms='' #Sort newest (even in any subdirectory) up top. # | grep -v '^sam/' | grep -v '^pof/' would handle the hyperlink pointing into sam instead of samlib. for OneRpm in `ls -A1 --sort=time *.rpm */*.rpm */*/*.rpm */*/*/*.rpm */*/*/*/*.rpm */*/*/*/*/*.rpm */*/*/*/*/*/*.rpm */*/*/*/*/*/*/*.rpm 2>/dev/null | grep -v '\.src\.rpm' | grep -v '^neweststable/'` ; do RpmName=`rpm --queryformat '%{NAME}' -qp $OneRpm` if ! InList "$ViewedRpms" "$RpmName" ; then ObjName=`echo "$OneRpm" | sed -e 's@.*/@@'` echo \ if echo "$OneRpm" | grep -q '/' ; then ObjPath=`echo "$OneRpm" | sed -e 's@\(.*\)/.*@\1@'` echo \\$ObjPath\/\$ObjName\\ else echo \\$ObjName\\ fi echo \ rpm -qpi "$OneRpm" | sed -e 's@<@\<@g' -e 's@>@\>@g' -e 's/\<\([a-zA-Z0-9\-_\.]*@[a-zA-Z0-9\-_\.]*\)\>/\<\1<\/a>\>/g' -e 's@^\(URL\W*:\W*\)\([^\W]*\)@\1\2@' echo \ ViewedRpms="$ViewedRpms $RpmName" fi done if [ -f htmlfilelist-footer.html ]; then echo \ cat htmlfilelist-footer.html fi if [ "$1" = "fullpage" ]; then cat < Generated `date` by htmlfilelist version $HtmlFileListVer EOFOOTER fi