#!/bin/sh
if which rsyslogd >/dev/null; then
    installs="rsyslogd /lib64/rsyslog/lmnet.so /lib64/rsyslog/imklog.so /lib64/rsyslog/imuxsock.so"
elif which syslogd >/dev/null; then
    installs="syslogd"
elif which syslog-ng >/dev/null; then
    installs="syslog-ng"
else
    dwarn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
fi
if [ -n "$installs" ]; then
    dracut_install cat
    dracut_install logger
    dracut_install $installs
    inst_hook cmdline  90 "$moddir/parse-syslog-opts.sh"
    inst_hook pre-udev 61 "$moddir/syslog-genrules.sh"
    inst_hook pre-pivot 99 "$moddir/syslog-cleanup.sh"
    inst_simple "$moddir/rsyslogd-start.sh" /sbin/rsyslogd-start
    inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
    mkdir -m 0755 -p ${initdir}/etc/templates
    inst_simple "${moddir}/rsyslog.conf" /etc/templates/rsyslog.conf
fi
