#!/bin/sh DAEMON=lighttpd DAEMON_LONG_NAME="lighttpd web server" DAEMON_CONFIG="/mod/etc/$DAEMON/$DAEMON.conf" DAEMON_ENV='LD_PRELOAD=' . /etc/init.d/modlibrc [ -r /etc/options.cfg ] && . /etc/options.cfg config() { modlib_config modunreg status lighttpd lighttpd-log if [ "$LIGHTTPD_LOGGING" = "yes" ]; then if [ "$LIGHTTPD_LOGGING_ERROR_FILE" = "yes" ] || [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_ACCESSLOG" = "y" -a "$LIGHTTPD_LOGGING_ACCESS_FILE" = "yes" ]; then modreg status lighttpd lighttpd-log lighttpd-log fi fi } start() { modlib_startdaemon $DAEMON -f $DAEMON_CONFIG } case $1 in ""|load) mkdir -p /mod/etc/$DAEMON mkdir -p /tmp/flash/$DAEMON #for compatibility reason only, may be removed later [ -e /tmp/flash/lighttpd_add ] && mv /tmp/flash/lighttpd_add /tmp/flash/lighttpd/add [ -e /tmp/flash/lighttpd_crt.pem ] && mv /tmp/flash/lighttpd_crt.pem /tmp/flash/lighttpd/crt.pem [ -e /tmp/flash/lighttpd_ca.pem ] && mv /tmp/flash/lighttpd_ca.pem /tmp/flash/lighttpd/ca.pem [ -e /tmp/flash/lighttpd-htdigest.user ] && mv /tmp/flash/lighttpd-htdigest.user /tmp/flash/lighttpd/htdigest.user [ -e /tmp/flash/lighttpd-rights.user ] && mv /tmp/flash/lighttpd-rights.user /tmp/flash/lighttpd/rights.user modlib_addgroup wwwrun modlib_adduser wwwrun -G wwwrun -s /bin/false -H -D -g "lighttpd account" modreg cgi 'lighttpd' 'lighttpd' modreg daemon $DAEMON if [ "$FREETZ_PACKAGE_LIGHTTPD_WITH_SSL" = "y" ]; then modreg file lighttpd crt 'Cert/Key' 0 "lighttpd_crt" modreg file lighttpd ca 'CA Cert' 0 "lighttpd_ca" fi if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_AUTH" = "y" ]; then modreg file lighttpd user '$(lang de:"Benutzerkonten" en:"Accounts")' 0 "lighttpd_user" modreg file lighttpd rights '$(lang de:"Zugriffsrechte" en:"Access rights")' 0 "lighttpd_rights" fi modreg file lighttpd add '$(lang de:"Erweitert" en:"Additional")' 0 "lighttpd_add" modlib_start $LIGHTTPD_ENABLED ;; unload) modunreg status lighttpd lighttpd-log modunreg file lighttpd modunreg daemon $DAEMON modunreg cgi lighttpd modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|reload|restart|status]" 1>&2 exit 1 ;; esac exit 0