]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/98syslog/syslog-genrules.sh
removed trailing whitespaces
[thirdparty/dracut.git] / modules.d / 98syslog / syslog-genrules.sh
1 #!/bin/sh
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4
5 # Creates the syslog udev rules to be triggered when interface becomes online.
6 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
7
8 detect_syslog() {
9 syslogtype=""
10 if [ -e /sbin/rsyslogd ]; then
11 syslogtype="rsyslogd"
12 elif [ -e /sbin/syslogd ]; then
13 syslogtype="syslogd"
14 elif [ /sbin/syslog-ng ]; then
15 syslogtype="syslog-ng"
16 else
17 warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
18 fi
19 echo "$syslogtype"
20 [ -n "$syslogtype" ]
21 }
22
23 read syslogtype < /tmp/syslog.type
24 if [ -z "$syslogtype" ]; then
25 syslogtype=$(detect_syslog)
26 echo $syslogtype > /tmp/syslog.type
27 fi
28 if [ -e "/sbin/${syslogtype}-start" ]; then
29 printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/initqueue --onetime /sbin/'${syslogtype}'-start $env{INTERFACE}"\n' > /etc/udev/rules.d/70-syslog.rules
30 else
31 warn "syslog-genrules: Could not find binary to start syslog of type \"$syslogtype\". Syslog will not be started."
32 fi