#!/bin/ash

# copyright 2004 vagrant@freegeek.org, distributed under the terms of the
# GNU General Public License version 2 or any later version.

if [ -z "$export_type" ]
then
  . /etc/lessdisks/server.config
fi

if [ -z "$rw" ]
then
  rw="/var/state/lessdisks"
fi

echo "exporting config files via $export_type"
case "$export_type" in
  # FIXME disable thy's cache? was problematically caching files for too long.
  thy) /usr/sbin/thy -l /8080 -w $rw/etc -o nopidfile -d text/plain ;;
  thttpd) /usr/sbin/thttpd -p 8080 -d $rw/etc -nos ;;
  khttpd) modprobe khttpd
    cd /proc/sys/net/khttpd
    echo "80" >  clientport
    echo "8080" >  serverport
    echo "$rw/etc" >  documentroot
    echo "1" >  sloppymime
    echo "1" >  start
    ;;
  *) if [ -x /etc/init.d/$export_type ] 
    then
      /etc/init.d/$export_type force-reload
    else
      echo "config file export type \"$export_type\" invalid"
      echo "this may make configuration of this terminal difficult"
      echo "if you do not intend to run X, this is probably not a big deal"
    fi
    ;;
esac
