cookutils view web/cooker.cgi @ rev 824

handle multiple cook in cooktime
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 06 09:08:56 2016 +0200 (2016-08-06)
parents e9aa5ca73c9a
children 47e7b3037588
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|&|\&amp;|g' -e 's|<|\&lt;|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/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/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'|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|'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|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|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 . $wok/$pkg/receipt
286 [ -n "$WEB_SITE" ] && # busybox wget -s $WEB_SITE &&
287 echo "<a href='$WEB_SITE'>home</a>"
289 if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then
290 echo "<a href='?files=$pkg'>files</a>"
291 unset EXTRAVERSION
292 . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt
293 if [ -f $wok/$pkg/taz/$PACKAGE-$VERSION/description.txt ]; then
294 echo "<a href='?description=$pkg'>description</a>"
295 fi
296 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg ]; then
297 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION.tazpkg'>download</a>"
298 fi
299 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg ]; then
300 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg'>download</a>"
301 fi
302 fi
303 [ -x ./man2html ] &&
304 if [ -d $wok/$pkg/install/usr/man -o -d $wok/$pkg/install/usr/share/man ]; then
305 echo "<a href='?man=$PACKAGE'>man</a>"
306 fi
307 if [ -d $wok/$pkg/install/usr/doc -o -d $wok/$pkg/install/usr/share/doc ]; then
308 echo "<a href='?doc=$PACKAGE'>doc</a>"
309 fi
310 if [ -d $wok/$pkg/install/usr/info -o -d $wok/$pkg/install/usr/share/info ]; then
311 echo "<a href='?info=$PACKAGE'>info</a>"
312 fi
313 echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
314 else
315 if [ $(ls $wok/*$pkg*/receipt 2> /dev/null | wc -l) -eq 0 ]; then
316 echo "No package named: $pkg"
317 else
318 ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
319 echo '<table style="width:100%">'
320 for i in $(cd $wok ; ls $pkg/receipt); do
321 pkg=$(dirname $i)
322 unset SHORT_DESC CATEGORY
323 . $wok/$pkg/receipt
324 cat <<EOT
325 <tr>
326 <td><a href="?pkg=$pkg">$pkg</a></td>
327 <td>$SHORT_DESC</td>
328 <td>$CATEGORY</td>
329 </tr>
330 EOT
331 done
332 echo '</table>'
333 unset pkg
334 fi
335 fi
336 echo '</div>'
338 # Check for a log file and display summary if it exists.
339 if [ -f "$log" ]; then
340 if grep -q "cook:$pkg$" $command; then
341 echo "<pre>The Cooker is currently building: $pkg</pre>"
342 fi
343 if fgrep -q "Summary for:" $LOGS/$pkg.log; then
344 echo '<h3>Cook summary</h3>'
345 echo '<pre>'
346 grep -A 12 "^Summary for:" $LOGS/$pkg.log | sed /^$/d | \
347 syntax_highlighter log
348 echo '</pre>'
349 fi
350 if fgrep -q "Debug information" $LOGS/$pkg.log; then
351 echo '<h3>Cook failed</h3>'
352 echo '<pre>'
353 grep -A 8 "^Debug information" $LOGS/$pkg.log | sed /^$/d | \
354 syntax_highlighter log
355 echo '</pre>'
356 fi
357 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
358 for i in $(ls -t $log.*); do
359 echo -n "<a href=\"?log=$(basename $i)\">"
360 echo "$(stat -c %y $i | sed 's/ .*//')</a>"
361 done
362 echo '<pre>'
363 cat $log | syntax_highlighter log
364 echo '</pre>'
365 case "$HTTP_USER_AGENT" in
366 *SliTaz*)
367 [ -f $CACHE/cooker-request ] && [ -n "$HTTP_REFERER" ] &&
368 echo "<a class=\"button\" href=\"?recook=$pkg\">Recook $pkg</a>"
369 esac
370 else
371 [ "$pkg" ] && echo "<pre>No log: $pkg</pre>"
372 fi ;;
374 log=*)
375 log=$LOGS/${QUERY_STRING#log=}
376 if [ -s $log ]; then
377 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
378 echo '<pre>'
379 cat $log | syntax_highlighter log
380 echo '</pre>'
381 fi
382 ;;
383 file=*)
384 # Don't allow all files on the system for security reasons.
385 file=${QUERY_STRING#file=}
386 case "$file" in
387 activity|cooknotes|cooklist)
388 [ "$file" == "cooklist" ] && \
389 nb="- Packages: $(cat $cooklist | wc -l)"
390 echo "<h2>DB: $file $nb</h2>"
391 echo '<pre>'
392 tac $CACHE/$file | syntax_highlighter activity
393 echo '</pre>' ;;
395 broken)
396 nb=$(cat $broken | wc -l)
397 echo "<h2>DB: broken - Packages: $nb</h2>"
398 echo '<pre>'
399 cat $CACHE/$file | sort | \
400 sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g
401 echo '</pre>' ;;
403 *.diff)
404 diff=$CACHE/$file
405 echo "<h2>Diff for: ${file%.diff}</h2>"
406 [ "$file" == "installed.diff" ] && echo \
407 "<p>This is the latest diff between installed packages \
408 and installed build dependencies to cook.</p>"
409 echo '<pre>'
410 cat $diff | syntax_highlighter diff
411 echo '</pre>' ;;
413 *.log)
414 log=$LOGS/$file
415 name=$(basename $log)
416 echo "<h2>Log for: ${name%.log}</h2>"
417 if [ -f "$log" ]; then
418 if fgrep -q "Summary" $log; then
419 echo '<pre>'
420 grep -A 20 "^Summary" $log | sed /^$/d | \
421 syntax_highlighter log
422 echo '</pre>'
423 fi
424 echo '<pre>'
425 cat $log | syntax_highlighter log
426 echo '</pre>'
427 else
428 echo "<pre>No log file: $log</pre>"
429 fi ;;
430 esac ;;
432 stuff=*)
433 file=${QUERY_STRING#stuff=}
434 echo "<h2>$file</h2>"
435 echo '<pre>'
436 cat $wok/$file | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
437 echo '</pre>' ;;
439 receipt=*)
440 pkg=${QUERY_STRING#receipt=}
441 echo "<h2>Receipt for: $pkg</h2>"
442 if [ -f "$wok/$pkg/receipt" ]; then
443 . $wok/$pkg/receipt
444 [ -n "$TARBALL" ] && [ -s "$SRC/$TARBALL" ] &&
445 echo "<a href='?src=$TARBALL'>source</a>"
447 ( cd $wok/$pkg ; find stuff -type f 2> /dev/null ) | \
448 while read file ; do
449 echo "<a href=\"?stuff=$pkg/$file\">$file</a>"
450 done | sort
451 echo '<pre>'
452 cat $wok/$pkg/receipt | \
453 syntax_highlighter receipt
454 echo '</pre>'
455 else
456 echo "<pre>No receipt for: $pkg</pre>"
457 fi ;;
459 files=*)
460 pkg=${QUERY_STRING#files=}
461 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
462 if [ -d "$dir/fs" ]; then
463 echo "<h2>Installed files by: $pkg ($(du -hs $dir/fs | awk '{ print $1 }'))</h2>"
464 echo '<pre>'
465 find $dir/fs -not -type d -print0 | xargs -0 ls -ld | \
466 sed "s|\(.*\) /.*\(${dir#*wok}/fs\)\(.*\)|\1 <a href=\"?download=../wok\2\3\">\3</a>|;s|^\([^-].*\)\(<a.*\)\">\(.*\)</a>|\1\3|"
467 echo '</pre>'
468 else
469 echo "<pre>No files list for: $pkg</pre>"
470 fi ;;
472 description=*)
473 pkg=${QUERY_STRING#description=}
474 echo "<h2>Description of $pkg</h2>"
475 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
476 if [ -s "$dir/description.txt" ]; then
477 echo '<pre>'
478 cat $dir/description.txt | \
479 sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
480 echo '</pre>'
481 else
482 echo "<pre>No description for: $pkg</pre>"
483 fi ;;
485 man=*|doc=*|info=*)
486 type=${QUERY_STRING%%=*}
487 pkg=$(GET $type)
488 dir=$WOK/$pkg/install/usr/share/$type
489 [ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
490 page=$(GET file)
491 if [ -z "$page" ]; then
492 page=$(find $dir -type f | sed q)
493 page=${page#$dir/}
494 fi
495 find $dir -type f | while read file ; do
496 [ -s $file ] || continue
497 case "$file" in
498 *.jp*g|*.png|*.gif|*.svg) continue
499 esac
500 file=${file#$dir/}
501 echo "<a href='?$type=$pkg&amp;file=$file'>$(basename $file)</a>"
502 done | sort
503 echo "<h2>$(basename $page)</h2>"
504 tmp="$(mktemp)"
505 docat "$dir/$page" > $tmp
506 [ -s "$tmp" ] && case "$type" in
507 info)
508 echo '<pre>'
509 info2html < "$tmp"
510 echo '</pre>' ;;
511 doc)
512 echo '<pre>'
513 case "$page" in
514 *.htm*) cat ;;
515 *) sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
516 esac < "$tmp"
517 echo '</pre>' ;;
518 man)
519 export TEXTDOMAIN='man2html'
520 ./man2html "$tmp" | sed -e '1,/<header>/d' \
521 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
522 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g' ;;
523 esac
524 rm -f $tmp
525 ;;
526 *)
527 # We may have a toolchain.cgi script for cross cooker's
528 if [ -f "toolchain.cgi" ]; then
529 toolchain='toolchain.cgi'
530 else
531 toolchain='?pkg=slitaz-toolchain'
532 fi
533 # Main page with summary. Count only package include in ARCH,
534 # use 'cooker arch-db' to manually create arch.$ARCH files.
535 inwok=$(ls $WOK/*/arch.$ARCH | wc -l)
536 cooked=$(ls $PKGS/*.tazpkg | wc -l)
537 unbuilt=$(($inwok - $cooked))
538 pct=0
539 [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok ))
540 cat <<EOT
541 <div style="float: right;">
542 <form method="get" action="$SCRIPT_NAME">
543 Package:
544 <input type="text" name="pkg" />
545 </form>
546 </div>
548 <h2>Summary</h2>
550 <pre>
551 Running command : $(running_command)
552 Wok revision : <a href="$WOK_URL">$(cat $wokrev)</a>
553 Commits to cook : $(cat $commits | wc -l)
554 Current cooklist : $(cat $cooklist | wc -l)
555 Broken packages : $(cat $broken | wc -l)
556 Blocked packages : $(cat $blocked | wc -l)
557 </pre>
558 EOT
559 [ -e $CACHE/cooker-request ] &&
560 [ $CACHE/activity -nt $CACHE/cooker-request ] && cat <<EOT
561 <div style="float: right;">
562 <a class="button" href="?poke">Poke cooker</a>
563 </div>
564 EOT
565 cat <<EOT
566 <p class="info">
567 Packages: $inwok in the wok | $cooked cooked | $unbuilt unbuilt |
568 Server date: $(date -u '+%F %R %Z')
569 </p>
570 <div class="pctbar">
571 <div class="pct" style="width: ${pct}%;">${pct}%</div>
572 </div>
574 <p>
575 Latest:
576 <a href="?file=cookorder.log">cookorder.log</a>
577 <a href="?file=commits.log">commits.log</a>
578 <a href="?file=pkgdb.log">pkgdb.log</a>
579 <a href="?file=installed.diff">installed.diff</a>
580 - Architecture $ARCH:
581 <a href="$toolchain">toolchain</a>
582 </p>
584 $(more_button activity "More activity" $CACHE/activity 12)
585 <h2 id="activity">Activity</h2>
586 <pre>
587 $(tac $CACHE/activity | head -n 12 | syntax_highlighter activity)
588 </pre>
589 EOT
591 [ -s $cooknotes ] && cat <<EOT
592 $(more_button cooknotes "More notes" $cooknotes 12)
593 <h2 id="cooknotes">Cooknotes</h2>
594 <pre>
595 $(tac $cooknotes | head -n 12 | syntax_highlighter activity)
596 </pre>
597 EOT
599 [ -s $commits ] && cat <<EOT
600 <h2 id="commits">Commits</h2>
601 <pre>
602 $(cat $commits)
603 </pre>
604 EOT
606 [ -s $cooklist ] && cat <<EOT
607 $(more_button cooklist "Full cooklist" $cooklist 20)
608 <h2 id="cooklist">Cooklist</h2>
609 <pre>
610 $(cat $cooklist | head -n 20)
611 </pre>
612 EOT
614 [ -s $broken ] && cat <<EOT
615 $(more_button broken "All broken packages" $broken 20)
616 <h2 id="broken">Broken</h2>
617 <pre>
618 $(cat $broken | head -n 20 | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
619 </pre>
620 EOT
622 [ -s $blocked ] && cat <<EOT
623 <h2 id="blocked">Blocked</h2>
624 <pre>
625 $(cat $blocked | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
626 </pre>
627 EOT
629 cat <<EOT
630 <h2 id="lastcook">Latest cook</h2>
631 <pre>
632 $(list_packages | sed s"#^\([^']*\).* : #<span class='log-date'>\0</span>#"g)
633 </pre>
634 EOT
635 ;;
636 esac
639 # Close xHTML page
641 cat <<EOT
642 </div>
644 <div id="footer">
645 <a href="http://www.slitaz.org/">SliTaz Website</a>
646 <a href="cooker.cgi">Cooker</a>
647 <a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
648 Documentation</a>
649 </div>
651 </body>
652 </html>
653 EOT
655 exit 0