#!/bin/sh

#NYLON_DIR=/usr/src/cross/nylon-build-stable-1.0/tmp/staging/i686-linux/bin
NYLON_DIR=/usr/src/cross/ff/trunk/openwrt/staging_dir_mipsel/usr/bin

rmbak=$(find -type f -name "*~")
test -n "$rmbak" && rm -v $rmbak
out=ff-web/srv/www
(cd ff-web-src;./template.pl -x "/index-new.html" -o ../$out)
#chown root:root . -R
find $out -type f -printf "chmod 0644 \"%p\"\n" | sh
find $out -type d -printf "chmod 0755 \"%p\"\n" | sh
find $out -type f -name "*.rrd" -printf "chmod 0755 \"%p\"\n" | sh
find $out -type f -name "cgi-bin*" -printf "chmod 0755 \"%p\"\n" | sh
find -type f -name "*.awk" -printf "chmod 0755 \"%p\"\n" | sh
chmod +x `file $(find -type f) | grep Bourne|sed -e 's/:.*//'`
$NYLON_DIR/ipkg-build -o root -g root ff-stability .
$NYLON_DIR/ipkg-build -o root -g root ff-web .
$NYLON_DIR/ipkg-build -o root -g root ff-watchdog .
$NYLON_DIR/ipkg-build -o root -g root ff .
$NYLON_DIR/ipkg-build -o root -g root ff-berlin-mapaddon .
$NYLON_DIR/ipkg-build -o root -g root kernel-module-dm9601 .

$NYLON_DIR/ipkg-make-index .>Packages
rm -f md5sum.asc;md5sum `find -maxdepth 1 -type f`>md5sum.asc
