#!/bin/sh
#
# SliTaz Pizza CGI/web interface - Let's have a pizza :-)
# Please KISS, it is important and keep speed in mind. Thanks, Pankso.
#
# Output a RSS feed of latest build isos.
if [ "$QUERY_STRING" == "rss" ]; then
. /etc/slitaz/pizza.conf
pubdate=$(date "+%a, %d %b %Y %X")
cat << EOT
Content-Type: text/xml
$(gettext "Choose your distribution name and the one you want to use as base. We need your mail to notify you when your SliTaz Flavor is built and if anything goes wrong.")
EOT ;; *\ gen\ *) # # Generate step # id="$(GET id)" . $tmpdir/slitaz-$id/receipt addfiles=$(find $tmpdir/slitaz-$id/addfiles -type f | wc -l) [ "$addfiles" ] || addfiles=0 packages=$(cat $tmpdir/slitaz-$id/packages.list | wc -l) cat << EOT$(gettext "Last chance to stop process or start over. Next step will pack your flavor and add it to the build queue. Here you can also add a note to your receipt flavor, this will be displayed on your flavor ID page and can be used to give more info to other users and SliTaz developers.")
Uniq ID : $id Flavor : $FLAVOR Short desc : $SHORT_DESC Maintainer : $MAINTAINER Packages : $packages Addfiles : $addfilesEOT ;; *\ cancel\ *) id="$(GET id)" echo "
$(gettext "Removing temporary files for:") $id
" [ -d "$tmpdir/slitaz-$id" ] && rm -rf $tmpdir/slitaz-$id/ cat << EOT EOT ;; *\ pack\ *) # # Pack distro step # id="$(GET id)" receipt="$tmpdir/slitaz-$id/receipt" addfiles="$(GET addfiles)" log="$tmpdir/slitaz-$id/distro.log" note="$(GET note)" inqueue=$(ls $queue | wc -l) . $receipt cat << EOTEOT if ! fgrep ADDFILES $receipt; then echo "ADDFILES=\"$addfiles\"" >> $receipt fi if ! fgrep NOTE $receipt; then echo "NOTE=\"$note\"" >> $receipt fi # The rootcd README echo -n "Creating SliTaz cdrom README..." date=$(date '+%Y-%m-%d %H:%M') mkdir -p $tmpdir/slitaz-$id/rootcd cp $DATA/README.distro $tmpdir/slitaz-$id/rootcd/README sed -i s"/_DATE_/$date/" $tmpdir/slitaz-$id/rootcd/README status echo -n "Creating flavor tarball..." cd $tmpdir && tar cjf $FLAVOR.tar.bz2 slitaz-$id mkdir -p $public/slitaz-$id mv $FLAVOR.tar.bz2 $public/slitaz-$id status # Keep a public receipt copy and move everything from tmp to queue. echo "Flavor packed : $(date '+%Y-%m-%d %H:%M')" | tee -a $log echo -n "Moving $id to Pizza build queue..." mv -f $tmpdir/slitaz-$id/distro.log $public/slitaz-$id cp -f $tmpdir/slitaz-$id/receipt $public/slitaz-$id mv $tmpdir/slitaz-$id $queue status if [ "$inqueue" == "1" ]; then gettext "Your ISO will be built on next Pizza Bot run" else eval_gettext "There are \$inqueue flavors in queue" fi echo "" echo "New flavor added to queue: $id ($FLAVOR)" | log cat << EOT
Uniq ID : $id Flavor : $FLAVOR Packages : $pkgslist in list - $pkgsinst installed Rootfs size : $ROOTFS_SIZE ISO size : $ISO_SIZE
' fgrep 'Build time' $log cat $log | highlighter log echo '' fi ;; *\ help\ *) echo "
' cat /usr/share/doc/pizza/README echo '' ;; *\ info\ *) # English only :-) if mount | fgrep -q slitaz/public; then mounted="Public is mounted" else mounted="WARRNING: Public is not mounted" fi echo '
' [ "$mounted" ] && echo "$mounted" echo -n "Public flavors : " && ls -1 public | wc -l echo -n "Public size : " && du -sh public | awk '{print $1}' echo -n "Tmp size : " && du -sh $tmpdir | awk '{print $1}' echo '' ;; *\ activity\ *) cat << EOT
$(tac $activity | highlighter activity)EOT ;; *) # # Main page # inqueue=$(ls $queue | wc -l) builds=$(cat $builds) pubiso=$(ls -1 public | wc -l) [ "$builds" ] || builds=0 cat << EOT