#!/usr/bin/execlineb -P
# lighttpd in foreground (-D), matching debian/sv/lighttpd.

envfile -I /etc/s6-rc/config/lighttpd.conf
importas -sCuD "-D -f /etc/lighttpd/lighttpd.conf" Args Args

foreground { install -d -o www-data -g www-data -m 0750 /run/lighttpd }
foreground { install -d -o www-data -g www-data -m 0750 /var/cache/lighttpd }
foreground { install -d -o www-data -g www-data -m 0750 /var/cache/lighttpd/compress }
foreground { install -d -o www-data -g www-data -m 0750 /var/cache/lighttpd/uploads }
foreground { install -d -o www-data -g www-data -m 0750 /var/log/lighttpd }

# Fail the longrun (restart) if configtest fails — same as previous shell run.
foreground { /usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf }

fdmove -c 2 1
exec /usr/sbin/lighttpd ${Args}
