#!/usr/bin/execlineb -P
# apcupsd in foreground (-b); ISCONFIGURED gate from /etc/default/apcupsd.

envfile -I /etc/default/apcupsd
importas -uD "" ISCONFIGURED ISCONFIGURED
envfile -I /etc/s6-rc/config/apcupsd.conf
importas -sCuD "-b" Args Args

ifelse { test "x${ISCONFIGURED}" = xyes } {
	foreground { /usr/lib/apcupsd/prestart }
	fdmove -c 2 1
	exec /usr/sbin/apcupsd ${Args}
}
s6-pause
