commit
d8c75b5f38
|
|
@ -17,7 +17,7 @@ install() {
|
|||
local _installs
|
||||
if type -P rsyslogd >/dev/null; then
|
||||
_installs="rsyslogd"
|
||||
inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so
|
||||
inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so rsyslog/imjournal.so
|
||||
elif type -P syslogd >/dev/null; then
|
||||
_installs="syslogd"
|
||||
elif type -P syslog-ng >/dev/null; then
|
||||
|
|
@ -29,12 +29,11 @@ install() {
|
|||
if [ -n "$_installs" ]; then
|
||||
inst_multiple cat $_installs
|
||||
inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh"
|
||||
inst_hook pre-udev 61 "$moddir/syslog-genrules.sh"
|
||||
inst_hook cleanup 99 "$moddir/syslog-cleanup.sh"
|
||||
inst_simple "$moddir/rsyslogd-start.sh" /sbin/rsyslogd-start
|
||||
inst_hook initqueue/online 70 "$moddir/rsyslogd-start.sh"
|
||||
inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
|
||||
mkdir -m 0755 -p ${initdir}/etc/templates
|
||||
inst_simple "${moddir}/rsyslog.conf" /etc/templates
|
||||
inst_simple "${moddir}/rsyslog.conf" /etc/templates/rsyslog.conf
|
||||
fi
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,30 @@
|
|||
# Don't auto detect syslog but set it
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
detect_syslog() {
|
||||
syslogtype=""
|
||||
if [ -e /sbin/rsyslogd ]; then
|
||||
syslogtype="rsyslogd"
|
||||
elif [ -e /sbin/syslogd ]; then
|
||||
syslogtype="syslogd"
|
||||
elif [ /sbin/syslog-ng ]; then
|
||||
syslogtype="syslog-ng"
|
||||
else
|
||||
warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
|
||||
fi
|
||||
echo "$syslogtype"
|
||||
[ -n "$syslogtype" ]
|
||||
}
|
||||
|
||||
syslogserver=$(getarg syslog.server -d syslog)
|
||||
syslogfilters=$(getargs syslog.filter -d filter)
|
||||
syslogtype=$(getarg syslog.type -d syslogtype)
|
||||
|
||||
[ -n "$syslogserver" ] && echo $syslogserver > /tmp/syslog.server
|
||||
[ -n "$syslogfilters" ] && echo "$syslogfilters" > /tmp/syslog.filters
|
||||
[ -n "$syslogtype" ] && echo "$syslogtype" > /tmp/syslog.type
|
||||
if [ -n "$syslogtype" ]; then
|
||||
echo "$syslogtype" > /tmp/syslog.type
|
||||
else
|
||||
syslogtype=$(detect_syslog)
|
||||
echo $syslogtype > /tmp/syslog.type
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Triggered by udev and starts rsyslogd with bootparameters
|
||||
# Triggered by initqueue/online and starts rsyslogd with bootparameters
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# prevent starting again if already running
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
read pid < /var/run/syslogd.pid
|
||||
kill -0 $pid && exit 0
|
||||
fi
|
||||
|
||||
rsyslog_config() {
|
||||
local server=$1
|
||||
shift
|
||||
|
|
@ -14,20 +20,28 @@ rsyslog_config() {
|
|||
|
||||
cat $syslog_template
|
||||
|
||||
for filter in $filters; do
|
||||
echo "${filter} @${server}"
|
||||
done
|
||||
# echo "*.* /tmp/syslog"
|
||||
(
|
||||
# disable shell expansion / globbing
|
||||
# since filters contain such characters
|
||||
set -f
|
||||
for filter in $filters; do
|
||||
echo "${filter} @${server}"
|
||||
done
|
||||
)
|
||||
#echo "*.* /tmp/syslog"
|
||||
}
|
||||
|
||||
read server < /tmp/syslog.server
|
||||
read filters < /tmp/syslog.filters
|
||||
[ -f /tmp/syslog.type ] && read type < /tmp/syslog.type
|
||||
[ -f /tmp/syslog.server ] && read server < /tmp/syslog.server
|
||||
[ -f /tmp/syslog.filters ] && read filters < /tmp/syslog.filters
|
||||
[ -z "$filters" ] && filters="kern.*"
|
||||
read conf < /tmp/syslog.conf
|
||||
[ -f /tmp/syslog.conf ] && read conf < /tmp/syslog.conf
|
||||
[ -z "$conf" ] && conf="/etc/rsyslog.conf" && echo "$conf" > /tmp/syslog.conf
|
||||
|
||||
template=/etc/templates/rsyslog.conf
|
||||
if [ -n "$server" ]; then
|
||||
rsyslog_config "$server" "$template" "$filters" > $conf
|
||||
rsyslogd -c3
|
||||
if [ $type == "rsyslogd" ]; then
|
||||
template=/etc/templates/rsyslog.conf
|
||||
if [ -n "$server" ]; then
|
||||
rsyslog_config "$server" "$template" "$filters" > $conf
|
||||
rsyslogd -c3
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
# Kills rsyslogd
|
||||
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
|
|
@ -8,4 +10,4 @@ if [ -f /var/run/syslogd.pid ]; then
|
|||
kill -0 $pid && kill -9 $pid
|
||||
else
|
||||
warn "rsyslogd-stop: Could not find a pid for rsyslogd. Won't kill it."
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Creates the syslog udev rules to be triggered when interface becomes online.
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
detect_syslog() {
|
||||
syslogtype=""
|
||||
if [ -e /sbin/rsyslogd ]; then
|
||||
syslogtype="rsyslogd"
|
||||
elif [ -e /sbin/syslogd ]; then
|
||||
syslogtype="syslogd"
|
||||
elif [ /sbin/syslog-ng ]; then
|
||||
syslogtype="syslog-ng"
|
||||
else
|
||||
warn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
|
||||
fi
|
||||
echo "$syslogtype"
|
||||
[ -n "$syslogtype" ]
|
||||
}
|
||||
|
||||
read syslogtype < /tmp/syslog.type
|
||||
if [ -z "$syslogtype" ]; then
|
||||
syslogtype=$(detect_syslog)
|
||||
echo $syslogtype > /tmp/syslog.type
|
||||
fi
|
||||
if [ -e "/sbin/${syslogtype}-start" ]; then
|
||||
printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/initqueue --onetime /sbin/'${syslogtype}'-start $env{INTERFACE}"\n' > /etc/udev/rules.d/70-syslog.rules
|
||||
else
|
||||
warn "syslog-genrules: Could not find binary to start syslog of type \"$syslogtype\". Syslog will not be started."
|
||||
fi
|
||||
Loading…
Reference in New Issue