cookutils view web/cooker.cgi @ rev 835
cooker.cgi: add some doc links
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Nov 14 09:12:09 2016 +0100 (2016-11-14) |
parents | 47e7b3037588 |
children | cc73035433ab |
line source
1 #!/bin/sh
2 #
3 # SliTaz Cooker CGI/web interface.
4 #
6 . /usr/lib/slitaz/httphelper.sh
8 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
9 [ -f "cook.conf" ] && . ./cook.conf
11 # The same wok as cook.
12 wok="$WOK"
14 # Cooker DB files.
15 activity="$CACHE/activity"
16 commits="$CACHE/commits"
17 cooklist="$CACHE/cooklist"
18 cookorder="$CACHE/cookorder"
19 command="$CACHE/command"
20 blocked="$CACHE/blocked"
21 broken="$CACHE/broken"
22 cooknotes="$CACHE/cooknotes"
23 cooktime="$CACHE/cooktime"
24 wokrev="$CACHE/wokrev"
26 # We're not logged and want time zone to display correct server date.
27 export TZ=$(cat /etc/TZ)
29 case "$QUERY_STRING" in
30 recook=*)
31 case "$HTTP_USER_AGENT" in
32 *SliTaz*)
33 grep -qs "^${QUERY_STRING#recook=}$" $CACHE/recook-packages ||
34 echo ${QUERY_STRING#recook=} >> $CACHE/recook-packages
35 esac
36 cat <<EOT
37 Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
39 EOT
40 exit ;;
41 poke)
42 touch $CACHE/cooker-request
43 cat <<EOT
44 Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
46 EOT
47 exit ;;
48 src*)
49 file=$(busybox httpd -d "$SRC/${QUERY_STRING#*=}")
50 cat <<EOT
51 Content-Type: application/octet-stream
52 Content-Length: $(stat -c %s "$file")
53 Content-Disposition: attachment; filename="$(basename "$file")"
55 EOT
56 cat "$file"
57 exit ;;
58 download*)
59 file=$(busybox httpd -d "$PKGS/${QUERY_STRING#*=}")
60 cat <<EOT
61 Content-Type: application/octet-stream
62 Content-Length: $(stat -c %s "$file")
63 Content-Disposition: attachment; filename="$(basename "$file")"
65 EOT
66 cat "$file"
67 exit ;;
68 rss)
69 cat <<EOT
70 Content-Type: application/rss+xml
72 EOT
73 ;;
74 *)
75 cat <<EOT
76 Content-Type: text/html; charset=utf-8
78 EOT
79 ;;
80 esac
83 # RSS feed generator
84 if [ "$QUERY_STRING" == 'rss' ]; then
85 pubdate=$(date -R)
86 cat <<EOT
87 <?xml version="1.0" encoding="utf-8" ?>
88 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
89 <channel>
90 <title>SliTaz Cooker</title>
91 <description>The SliTaz packages cooker feed</description>
92 <link>$COOKER_URL</link>
93 <lastBuildDate>$pubdate</lastBuildDate>
94 <pubDate>$pubdate</pubDate>
95 <atom:link href="http://cook.slitaz.org/?rss" rel="self" type="application/rss+xml" />
96 EOT
97 for rss in $(ls -lt $FEEDS/*.xml | head -n 12); do
98 cat $rss | sed 's|<guid|& isPermaLink="false"|g;s|</pubDate| GMT&|g'
99 done
100 cat <<EOT
101 </channel>
102 </rss>
103 EOT
104 exit 0
105 fi
108 #
109 # Functions
110 #
113 # Unpack to stdout
115 docat() {
116 case "$1" in
117 *gz) zcat ;;
118 *bz2) bzcat ;;
119 *xz) xzcat ;;
120 *) cat
121 esac < $1
122 }
125 # Tiny texinfo browser
127 info2html() {
128 sed \
129 -e 's|&|\&|g' -e 's|<|\<|g' \
130 -e 's|^\* \(.*\)::|* <a href="#\1">\1</a> |' \
131 -e 's|\*note \(.*\)::|<a href="#\1">\1</a>|' \
132 -e '/^File: /s|(dir)|Top|g' \
133 -e '/^File: /s|Node: \([^,]*\)|Node: <a name="\1"></a><u>\1</u>|' \
134 -e '/^File: /s|Next: \([^,]*\)|Next: <a href="#\1">\1</a>|' \
135 -e '/^File: /s|Prev: \([^,]*\)|Prev: <a href="#\1">\1</a>|' \
136 -e '/^File: /s|Up: \([^,]*\)|Up: <a href="#\1">\1</a>|' \
137 -e '/^File: /s|^.*$|<i>&</i>|' \
138 -e '/^Tag Table:$/,/^End Tag Table$/d' \
139 -e '/INFO-DIR/,/^END-INFO-DIR/d' \
140 -e "s|https*://[^>),'\"\` ]*|<a href=\"&\">&</a>|g" \
141 -e "s|ftp://[^>),\"\` ]*|<a href=\"&\">&</a>|g"
142 }
145 # Put some colors in log and DB files.
147 syntax_highlighter() {
148 case $1 in
149 log)
150 # If variables not defined - define them with some rare values
151 : ${_src=#_#_#}
152 : ${_install=#_#_#}
153 : ${_fs=#_#_#}
154 : ${_stuff=#_#_#}
155 sed -e 's/&/\&/g;s/</\</g;s/>/\>/g' \
156 -e 's#OK$#<span class="span-ok">OK</span>#g' \
157 -e 's#Done$#<span class="span-ok">Done</span>#g' \
158 -e 's#yes$#<span class="span-ok">yes</span>#g' \
159 -e 's#no$#<span class="span-no">no</span>#g' \
160 -e 's#error$#<span class="span-red">error</span>#g' \
161 -e 's#ERROR:#<span class="span-red">ERROR:</span>#g' \
162 -e 's#WARNING:#<span class="span-red">WARNING:</span>#g' \
163 -e s"#^Executing:\([^']*\).#<span class='sh-val'>\0</span>#"g \
164 -e s"#^====\([^']*\).#<span class='span-line'>\0</span>#"g \
165 -e s"#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#"g \
166 -e s"#ftp://[^ '\"]*#<a href='\0'>\0</a>#"g \
167 -e s"#http://[^ '\"]*#<a href='\0'>\0</a>#"g | \
168 sed "s|$_src|<span class='var'>\${src}</span>|g;
169 s|$_install|<span class='var'>\${install}</span>|g;
170 s|$_fs|<span class='var'>\${fs}</span>|g;
171 s|$_stuff|<span class='var'>\${stuff}</span>|g"
172 ;;
174 receipt)
175 sed -e s'|&|\&|g' -e 's|<|\<|g' -e 's|>|\>|'g \
176 -e s"#^\#\([^']*\)#<span class='sh-comment'>\0</span>#"g \
177 -e s"#\"\([^']*\)\"#<span class='sh-val'>\0</span>#"g ;;
179 diff)
180 sed -e 's|&|\&|g' -e 's|<|\<|g' -e 's|>|\>|g' \
181 -e s"#^-\([^']*\).#<span class='span-red'>\0</span>#"g \
182 -e s"#^+\([^']*\).#<span class='span-ok'>\0</span>#"g \
183 -e s"#@@\([^']*\)@@#<span class='span-sky'>@@\1@@</span>#"g ;;
185 activity)
186 sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g ;;
187 esac
188 }
191 # Latest build pkgs.
193 list_packages() {
194 cd $PKGS
195 ls -1t *.tazpkg | head -20 | \
196 while read file; do
197 echo -n $(TZ=UTC stat -c '%y' $PKGS/$file | cut -d . -f 1 | sed s/:[0-9]*$//)
198 echo " : $file"
199 done
200 }
203 # Optional full list button
205 more_button() {
206 [ $(wc -l < ${3:-$CACHE/$1}) -gt ${4:-12} ] && cat <<EOT
207 <div style="float: right;">
208 <a class="button" href="?file=$1">$2</a>
209 </div>
210 EOT
211 }
214 # Show the running command and its progression
216 running_command()
217 {
218 local state="Not running"
219 if [ -s "$command" ]; then
220 state="$(cat $command)"
221 set -- $(grep "^$state" $cooktime)
222 if [ -n "$1" ]; then
223 state="$state $((($(date +%s)-$3)*100/$2))%"
224 [ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))"
225 fi
226 fi
227 echo $state
228 }
231 # xHTML header. Pages can be customized with a separated html.header file.
233 if [ -f "header.html" ]; then
234 cat header.html
235 else
236 cat <<EOT
237 <!DOCTYPE html>
238 <html lang="en">
239 <head>
240 <meta charset="utf-8"/>
241 <title>SliTaz Cooker</title>
242 <link rel="shortcut icon" href="favicon.ico"/>
243 <link rel="stylesheet" type="text/css" href="style.css"/>
244 <meta name="robots" content="nofollow">
245 </head>
246 <body>
248 <div id="header">
249 <div id="logo"></div>
250 <h1><a href="cooker.cgi">SliTaz Cooker</a></h1>
251 </div>
253 <!-- Content -->
254 <div id="content">
255 EOT
256 fi
259 #
260 # Load requested page
261 #
263 case "${QUERY_STRING}" in
264 pkg=*)
265 pkg=${QUERY_STRING#pkg=}
266 log=$LOGS/$pkg.log
267 echo "<h2>Package: $pkg</h2>"
269 # Define cook variables for syntax highlighter
270 if [ -s "$WOK/$pkg/receipt" ]; then
271 . "$WOK/$pkg/receipt"
272 _wok='/home/slitaz/wok'
273 _src="$_wok/$pkg/source/$PACKAGE-$VERSION"
274 _install="$_wok/$pkg/install"
275 _fs="$_wok/$pkg/taz/$PACKAGE-$VERSION/fs"
276 _stuff="$_wok/$pkg/stuff"
277 fi
279 # Package info.
280 echo '<div id="info">'
281 if [ -f "$wok/$pkg/receipt" ]; then
282 echo "<a href='?receipt=$pkg'>receipt</a>"
283 unset WEB_SITE
284 unset WANTED
285 bpkg=$pkg
286 . $wok/$pkg/receipt
288 [ -n "$WANTED" ] && bpkg="$WANTED"
289 [ -n "$WEB_SITE" ] && # busybox wget -s $WEB_SITE &&
290 echo "<a href='$WEB_SITE'>home</a>"
292 if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then
293 echo "<a href='?files=$pkg'>files</a>"
294 unset EXTRAVERSION
295 . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt
296 if [ -f $wok/$pkg/taz/$PACKAGE-$VERSION/description.txt ]; then
297 echo "<a href='?description=$pkg'>description</a>"
298 fi
299 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg ]; then
300 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION.tazpkg'>download</a>"
301 fi
302 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg ]; then
303 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg'>download</a>"
304 fi
305 fi
306 [ -x ./man2html ] &&
307 if [ -d $wok/$bpkg/install/usr/man ] ||
308 [ -d $wok/$bpkg/install/usr/share/man ] ||
309 [ -d $wok/$bpkg/taz/*/fs/usr/man ] ||
310 [ -d $wok/$bpkg/taz/*/fs/usr/share/man ]; then
311 echo "<a href='?man=$bpkg'>man</a>"
312 fi
313 if [ -d $wok/$bpkg/install/usr/doc ] ||
314 [ -d $wok/$bpkg/install/usr/share/doc ] ||
315 [ -d $wok/$bpkg/taz/*/fs/usr/doc ] ||
316 [ -d $wok/$bpkg/taz/*/fs/usr/share/doc ]; then
317 echo "<a href='?doc=$bpkg'>doc</a>"
318 fi
319 if [ -d $wok/$bpkg/install/usr/info ] ||
320 [ -d $wok/$bpkg/install/usr/share/info ] ||
321 [ -d $wok/$bpkg/taz/*/fs/usr/info ] ||
322 [ -d $wok/$bpkg/taz/*/fs/usr/share/info ]; then
323 echo "<a href='?info=$bpkg'>info</a>"
324 fi
325 echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
326 else
327 if [ $(ls $wok/*$pkg*/receipt 2> /dev/null | wc -l) -eq 0 ]; then
328 echo "No package named: $pkg"
329 else
330 ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
331 echo '<table style="width:100%">'
332 for i in $(cd $wok ; ls $pkg/receipt); do
333 pkg=$(dirname $i)
334 unset SHORT_DESC CATEGORY
335 . $wok/$pkg/receipt
336 cat <<EOT
337 <tr>
338 <td><a href="?pkg=$pkg">$pkg</a></td>
339 <td>$SHORT_DESC</td>
340 <td>$CATEGORY</td>
341 </tr>
342 EOT
343 done
344 echo '</table>'
345 unset pkg
346 fi
347 fi
348 echo '</div>'
350 # Check for a log file and display summary if it exists.
351 if [ -f "$log" ]; then
352 if grep -q "cook:$pkg$" $command; then
353 echo "<pre>The Cooker is currently building: $pkg</pre>"
354 fi
355 if fgrep -q "Summary for:" $LOGS/$pkg.log; then
356 echo '<h3>Cook summary</h3>'
357 echo '<pre>'
358 grep -A 12 "^Summary for:" $LOGS/$pkg.log | sed /^$/d | \
359 syntax_highlighter log
360 echo '</pre>'
361 fi
362 if fgrep -q "Debug information" $LOGS/$pkg.log; then
363 echo '<h3>Cook failed</h3>'
364 echo '<pre>'
365 grep -A 8 "^Debug information" $LOGS/$pkg.log | sed /^$/d | \
366 syntax_highlighter log
367 echo '</pre>'
368 fi
369 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
370 for i in $(ls -t $log.*); do
371 echo -n "<a href=\"?log=$(basename $i)\">"
372 echo "$(stat -c %y $i | sed 's/ .*//')</a>"
373 done
374 echo '<pre>'
375 cat $log | syntax_highlighter log
376 echo '</pre>'
377 case "$HTTP_USER_AGENT" in
378 *SliTaz*)
379 [ -f $CACHE/cooker-request ] && [ -n "$HTTP_REFERER" ] &&
380 echo "<a class=\"button\" href=\"?recook=$pkg\">Recook $pkg</a>"
381 esac
382 else
383 [ "$pkg" ] && echo "<pre>No log: $pkg</pre>"
384 fi ;;
386 log=*)
387 log=$LOGS/${QUERY_STRING#log=}
388 if [ -s $log ]; then
389 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
390 echo '<pre>'
391 cat $log | syntax_highlighter log
392 echo '</pre>'
393 fi
394 ;;
395 file=*)
396 # Don't allow all files on the system for security reasons.
397 file=${QUERY_STRING#file=}
398 case "$file" in
399 activity|cooknotes|cooklist)
400 [ "$file" == "cooklist" ] && \
401 nb="- Packages: $(cat $cooklist | wc -l)"
402 echo "<h2>DB: $file $nb</h2>"
403 echo '<pre>'
404 tac $CACHE/$file | syntax_highlighter activity
405 echo '</pre>' ;;
407 broken)
408 nb=$(cat $broken | wc -l)
409 echo "<h2>DB: broken - Packages: $nb</h2>"
410 echo '<pre>'
411 cat $CACHE/$file | sort | \
412 sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g
413 echo '</pre>' ;;
415 *.diff)
416 diff=$CACHE/$file
417 echo "<h2>Diff for: ${file%.diff}</h2>"
418 [ "$file" == "installed.diff" ] && echo \
419 "<p>This is the latest diff between installed packages \
420 and installed build dependencies to cook.</p>"
421 echo '<pre>'
422 cat $diff | syntax_highlighter diff
423 echo '</pre>' ;;
425 *.log)
426 log=$LOGS/$file
427 name=$(basename $log)
428 echo "<h2>Log for: ${name%.log}</h2>"
429 if [ -f "$log" ]; then
430 if fgrep -q "Summary" $log; then
431 echo '<pre>'
432 grep -A 20 "^Summary" $log | sed /^$/d | \
433 syntax_highlighter log
434 echo '</pre>'
435 fi
436 echo '<pre>'
437 cat $log | syntax_highlighter log
438 echo '</pre>'
439 else
440 echo "<pre>No log file: $log</pre>"
441 fi ;;
442 esac ;;
444 stuff=*)
445 file=${QUERY_STRING#stuff=}
446 echo "<h2>$file</h2>"
447 echo '<pre>'
448 cat $wok/$file | sed 's/&/\&/g;s/</\</g;s/>/\>/g'
449 echo '</pre>' ;;
451 receipt=*)
452 pkg=${QUERY_STRING#receipt=}
453 echo "<h2>Receipt for: $pkg</h2>"
454 if [ -f "$wok/$pkg/receipt" ]; then
455 . $wok/$pkg/receipt
456 [ -n "$TARBALL" ] && [ -s "$SRC/$TARBALL" ] &&
457 echo "<a href='?src=$TARBALL'>source</a>"
459 ( cd $wok/$pkg ; find stuff -type f 2> /dev/null ) | \
460 while read file ; do
461 echo "<a href=\"?stuff=$pkg/$file\">$file</a>"
462 done | sort
463 echo '<pre>'
464 cat $wok/$pkg/receipt | \
465 syntax_highlighter receipt
466 echo '</pre>'
467 else
468 echo "<pre>No receipt for: $pkg</pre>"
469 fi ;;
471 files=*)
472 pkg=${QUERY_STRING#files=}
473 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
474 if [ -d "$dir/fs" ]; then
475 echo "<h2>Installed files by: $pkg ($(du -hs $dir/fs | awk '{ print $1 }'))</h2>"
476 echo '<pre>'
477 find $dir/fs -not -type d -print0 | xargs -0 ls -ld | \
478 sed "s|\(.*\) /.*\(${dir#*wok}/fs\)\(.*\)|\1 <a href=\"?download=../wok\2\3\">\3</a>|;s|^\([^-].*\)\(<a.*\)\">\(.*\)</a>|\1\3|"
479 echo '</pre>'
480 else
481 echo "<pre>No files list for: $pkg</pre>"
482 fi ;;
484 description=*)
485 pkg=${QUERY_STRING#description=}
486 echo "<h2>Description of $pkg</h2>"
487 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
488 if [ -s "$dir/description.txt" ]; then
489 echo '<pre>'
490 cat $dir/description.txt | \
491 sed 's/&/\&/g;s/</\</g;s/>/\>/g'
492 echo '</pre>'
493 else
494 echo "<pre>No description for: $pkg</pre>"
495 fi ;;
497 man=*|doc=*|info=*)
498 type=${QUERY_STRING%%=*}
499 pkg=$(GET $type)
500 dir=$WOK/$pkg/install/usr/share/$type
501 [ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
502 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/share/$type)
503 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/$type)
504 page=$(GET file)
505 if [ -z "$page" ]; then
506 page=$(find $dir -type f | sed q)
507 page=${page#$dir/}
508 fi
509 find $dir -type f | while read file ; do
510 [ -s $file ] || continue
511 case "$file" in
512 *.jp*g|*.png|*.gif|*.svg) continue
513 esac
514 file=${file#$dir/}
515 echo "<a href='?$type=$pkg&file=$file'>$(basename $file)</a>"
516 done | sort
517 echo "<h2>$(basename $page)</h2>"
518 tmp="$(mktemp)"
519 docat "$dir/$page" > $tmp
520 [ -s "$tmp" ] && case "$type" in
521 info)
522 echo '<pre>'
523 info2html < "$tmp"
524 echo '</pre>' ;;
525 doc)
526 echo '<pre>'
527 case "$page" in
528 *.htm*) cat ;;
529 *) sed 's/&/\&/g;s/</\</g;s/>/\>/g'
530 esac < "$tmp"
531 echo '</pre>' ;;
532 man)
533 export TEXTDOMAIN='man2html'
534 ./man2html "$tmp" | sed -e '1,/<header>/d' \
535 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
536 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g' ;;
537 esac
538 rm -f $tmp
539 ;;
540 *)
541 # We may have a toolchain.cgi script for cross cooker's
542 if [ -f "toolchain.cgi" ]; then
543 toolchain='toolchain.cgi'
544 else
545 toolchain='?pkg=slitaz-toolchain'
546 fi
547 # Main page with summary. Count only package include in ARCH,
548 # use 'cooker arch-db' to manually create arch.$ARCH files.
549 inwok=$(ls $WOK/*/arch.$ARCH | wc -l)
550 cooked=$(ls $PKGS/*.tazpkg | wc -l)
551 unbuilt=$(($inwok - $cooked))
552 pct=0
553 [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok ))
554 cat <<EOT
555 <div style="float: right;">
556 <form method="get" action="$SCRIPT_NAME">
557 Package:
558 <input type="text" name="pkg" />
559 </form>
560 </div>
562 <h2>Summary</h2>
564 <pre>
565 Running command : $(running_command)
566 Wok revision : <a href="$WOK_URL">$(cat $wokrev)</a>
567 Commits to cook : $(cat $commits | wc -l)
568 Current cooklist : $(cat $cooklist | wc -l)
569 Broken packages : $(cat $broken | wc -l)
570 Blocked packages : $(cat $blocked | wc -l)
571 </pre>
572 EOT
573 [ -e $CACHE/cooker-request ] &&
574 [ $CACHE/activity -nt $CACHE/cooker-request ] && cat <<EOT
575 <div style="float: right;">
576 <a class="button" href="?poke">Poke cooker</a>
577 </div>
578 EOT
579 cat <<EOT
580 <p class="info">
581 Packages: $inwok in the wok | $cooked cooked | $unbuilt unbuilt |
582 Server date: $(date -u '+%F %R %Z')
583 </p>
584 <div class="pctbar">
585 <div class="pct" style="width: ${pct}%;">${pct}%</div>
586 </div>
588 <p>
589 Latest:
590 <a href="?file=cookorder.log">cookorder.log</a>
591 <a href="?file=commits.log">commits.log</a>
592 <a href="?file=pkgdb.log">pkgdb.log</a>
593 <a href="?file=installed.diff">installed.diff</a>
594 - Architecture $ARCH:
595 <a href="$toolchain">toolchain</a>
596 </p>
598 $(more_button activity "More activity" $CACHE/activity 12)
599 <h2 id="activity">Activity</h2>
600 <pre>
601 $(tac $CACHE/activity | head -n 12 | syntax_highlighter activity)
602 </pre>
603 EOT
605 [ -s $cooknotes ] && cat <<EOT
606 $(more_button cooknotes "More notes" $cooknotes 12)
607 <h2 id="cooknotes">Cooknotes</h2>
608 <pre>
609 $(tac $cooknotes | head -n 12 | syntax_highlighter activity)
610 </pre>
611 EOT
613 [ -s $commits ] && cat <<EOT
614 <h2 id="commits">Commits</h2>
615 <pre>
616 $(cat $commits)
617 </pre>
618 EOT
620 [ -s $cooklist ] && cat <<EOT
621 $(more_button cooklist "Full cooklist" $cooklist 20)
622 <h2 id="cooklist">Cooklist</h2>
623 <pre>
624 $(cat $cooklist | head -n 20)
625 </pre>
626 EOT
628 [ -s $broken ] && cat <<EOT
629 $(more_button broken "All broken packages" $broken 20)
630 <h2 id="broken">Broken</h2>
631 <pre>
632 $(cat $broken | head -n 20 | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
633 </pre>
634 EOT
636 [ -s $blocked ] && cat <<EOT
637 <h2 id="blocked">Blocked</h2>
638 <pre>
639 $(cat $blocked | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
640 </pre>
641 EOT
643 cat <<EOT
644 <h2 id="lastcook">Latest cook</h2>
645 <pre>
646 $(list_packages | sed s"#^\([^']*\).* : #<span class='log-date'>\0</span>#"g)
647 </pre>
648 EOT
649 ;;
650 esac
653 # Close xHTML page
655 cat <<EOT
656 </div>
658 <div id="footer">
659 <a href="http://www.slitaz.org/">SliTaz Website</a>
660 <a href="cooker.cgi">Cooker</a>
661 <a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
662 Documentation</a>
663 </div>
665 </body>
666 </html>
667 EOT
669 exit 0