cookutils rev 814

cooker.cgi: look for /usr/share/man and /usr/man
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 06 16:57:55 2016 +0200 (2016-07-06)
parents d3b274c35d2d
children 48ebce528e77
files web/cooker.cgi
line diff
     1.1 --- a/web/cooker.cgi	Tue Jul 05 21:55:50 2016 +0200
     1.2 +++ b/web/cooker.cgi	Wed Jul 06 16:57:55 2016 +0200
     1.3 @@ -270,10 +270,11 @@
     1.4  					echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg'>download</a>"
     1.5  				fi
     1.6  			fi
     1.7 -			if [ -x ./man2html -a -d $wok/$pkg/install/usr/share/man ]; then
     1.8 +			[ -x ./man2html ] &&
     1.9 +			if [ -d $wok/$pkg/install/usr/man -o -d $wok/$pkg/install/usr/share/man ]; then
    1.10  				echo "<a href='?man=$PACKAGE'>man</a>"
    1.11  			fi
    1.12 -			if [ -d $wok/$pkg/install/usr/share/doc ]; then
    1.13 +			if [ -d $wok/$pkg/install/usr/doc -o -d $wok/$pkg/install/usr/share/doc ]; then
    1.14  				echo "<a href='?doc=$PACKAGE'>doc</a>"
    1.15  			fi
    1.16  			echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
    1.17 @@ -435,19 +436,24 @@
    1.18  		type=${QUERY_STRING%%=*}
    1.19  		pkg=$(GET $type)
    1.20  		dir=$WOK/$pkg/install/usr/share/$type
    1.21 +		[ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
    1.22  		page=$(GET file)
    1.23  		if [ -z "$page" ]; then
    1.24  			page=$(find $dir -type f | sed q)
    1.25  			page=${page#$dir/}
    1.26  		fi
    1.27  		find $dir -type f | while read file ; do
    1.28 +			[ -s $file ] || continue
    1.29 +			case "$file" in
    1.30 +			*.jp*g|*.png|*.gif|*.svg) continue
    1.31 +			esac
    1.32  			file=${file#$dir/}
    1.33  			echo "<a href='?$type=$pkg&amp;file=$file'>$(basename $file)</a>"
    1.34  		done
    1.35  		echo "<h2>$(basename $page)</h2>"
    1.36  		tmp="$(mktemp)"
    1.37  		docat "$dir/$page" > $tmp
    1.38 -		case "$type" in
    1.39 +		[ -s "$tmp" ] && case "$type" in
    1.40  		doc)
    1.41  			echo '<pre>'
    1.42  			case "$page" in