#!/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 rm -f /var/log/${DAEMON}_*.log 2>/dev/null 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 [ "$LIGHTTPD_CHROOT" = "yes" ] && local chroot_prefix="${LIGHTTPD_DOCROOT}/" ln -sf $chroot_prefix$LIGHTTPD_LOGGING_ERROR /var/log/${DAEMON}_error.log ln -sf $chroot_prefix$LIGHTTPD_LOGGING_ACCESS /var/log/${DAEMON}_access.log modreg status lighttpd lighttpd 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 modlib_add_user_and_group wwwrun 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