#!/bin/sh
# Begin section update-alternatives
update-alternatives --install /etc/syslog.conf syslog-conf /etc/syslog.conf.busybox 50
update-alternatives --install /etc/init.d/syslog syslog-init /etc/init.d/syslog.busybox 50
update-alternatives --install /etc/syslog-startup.conf syslog-startup-conf /etc/syslog-startup.conf.busybox 50
# End section update-alternatives
# Begin section update-rc.d
if [ -n "$D" -o ! -d /run/systemd/system ] && type update-rc.d >/dev/null 2>/dev/null; then
	if [ -n "$D" ]; then
		OPT="-r $D"
	else
		OPT="-s"
	fi
	update-rc.d $OPT syslog defaults
fi
# End section update-rc.d
OPTS=""

if [ -n "$D" ]; then
    OPTS="--root=$D"
fi

if type systemctl >/dev/null 2>/dev/null; then
	if [ -z "$D" ]; then
		systemctl daemon-reload
	fi

	systemctl $OPTS enable busybox-syslog.service

	if [ -z "$D" -a "enable" = "enable" ]; then
		systemctl --no-block restart busybox-syslog.service
	fi
fi
