2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-26 13:10:35 +00:00

modify genimage according to the change of the path of syslog dracut module

This commit is contained in:
immarvin
2015-08-03 04:44:44 -04:00
parent 1831aca0bf
commit 2751d49247
10 changed files with 19 additions and 384 deletions

View File

@@ -1,58 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2+
#
# Copyright 2008-2010, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
while [ $# -gt 0 ]; do
case "$1" in
--onetime)
onetime="yes";;
--settled)
qname="/settled";;
--finished)
qname="/finished";;
--timeout)
qname="/timeout";;
--online)
qname="/online";;
--unique)
unique="yes";;
--name)
name="$2";shift;;
--env)
env="$2"; shift;;
*)
break;;
esac
shift
done
if [ -z "$unique" ]; then
job="${name}$$"
else
job="${name:-$1}"
job=${job##*/}
fi
exe=$1
shift
[ -x "$exe" ] || exe=$(command -v $exe)
{
[ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'
[ -n "$env" ] && echo "$env"
echo "$exe $@"
} > "/tmp/$$-${job}.sh"
mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
[ -z "$qname" ] && >> $hookdir/initqueue/work
exit 0

View File

@@ -1,40 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# do not add this module by default
return 255
}
depends() {
return 0
}
install() {
local _i
local _installs
if type -P rsyslogd >/dev/null; then
_installs="rsyslogd"
inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so
elif type -P syslogd >/dev/null; then
_installs="syslogd"
elif type -P syslog-ng >/dev/null; then
_installs="syslog-ng"
else
derror "Could not find any syslog binary although the syslogmodule" \
"is selected to be installed. Please check."
fi
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_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
dracut_need_initqueue
}

View File

@@ -1,51 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Triggered by udev and starts rsyslogd with bootparameters
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
rsyslog_config() {
local server=$1
shift
local syslog_template=$1
shift
local filters=$*
local filter=
local confline=
cat $syslog_template
# for filter in $filters; do
# echo "${filter} @${server}"
# done
if [ -n "$filters" ];then
confline="${filters}";
else
confline="*.*"
fi
if [ -n "$server" ];then
confline="$confline @${server}"
else
confline="$confline /var/log/messages"
fi
echo "$confline"
# echo "*.* /tmp/syslog"
}
read server < /tmp/syslog.server
read filters < /tmp/syslog.filters
[ -z "$filters" ] && filters="kern.*"
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 -i /var/run/syslogd.pid
fi

View File

@@ -1,34 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=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
#printf 'ATTR{operstate}!="down", SUBSYSTEM=="net", RUN+="/sbin/initqueue --onetime /sbin/'${syslogtype}'-start $env{INTERFACE}"\n' > /etc/udev/rules.d/70-syslog.rules
/sbin/initqueue --online --onetime /sbin/${syslogtype}-start
else
warn "syslog-genrules: Could not find binary to start syslog of type \"$syslogtype\". Syslog will not be started."
fi

View File

@@ -829,22 +829,23 @@ sub mkinitrd_dracut {
}
if ($dracutver > "033") {
my $perm = (stat("$fullpath/$dracutdir/patch/initqueue.sh"))[2];
cp("$fullpath/$dracutdir/patch/initqueue.sh", $dracutmoduledir."99base/");
if ($dracutver >= "033") {
my $perm = (stat("$fullpath/$dracutdir/patch/base/initqueue.sh"))[2];
cp("$fullpath/$dracutdir/patch/base/initqueue.sh", $dracutmoduledir."99base/");
chmod($perm&07777, $dracutmoduledir."99base/"."initqueue.sh");
$perm = (stat("$fullpath/$dracutdir/patch/module-setup.sh"))[2];
cp("$fullpath/$dracutdir/patch/module-setup.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/module-setup.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/module-setup.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."module-setup.sh");
$perm = (stat("$fullpath/$dracutdir/patch/rsyslogd-start.sh"))[2];
cp("$fullpath/$dracutdir/patch/rsyslogd-start.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/rsyslogd-start.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/rsyslogd-start.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."rsyslogd-start.sh");
$perm = (stat("$fullpath/$dracutdir/patch/syslog-genrules.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog-genrules.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/syslog-genrules.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/syslog-genrules.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."syslog-genrules.sh");
}

View File

@@ -1,58 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Licensed under the GPLv2+
#
# Copyright 2008-2010, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
while [ $# -gt 0 ]; do
case "$1" in
--onetime)
onetime="yes";;
--settled)
qname="/settled";;
--finished)
qname="/finished";;
--timeout)
qname="/timeout";;
--online)
qname="/online";;
--unique)
unique="yes";;
--name)
name="$2";shift;;
--env)
env="$2"; shift;;
*)
break;;
esac
shift
done
if [ -z "$unique" ]; then
job="${name}$$"
else
job="${name:-$1}"
job=${job##*/}
fi
exe=$1
shift
[ -x "$exe" ] || exe=$(command -v $exe)
{
[ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'
[ -n "$env" ] && echo "$env"
echo "$exe $@"
} > "/tmp/$$-${job}.sh"
mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
[ -z "$qname" ] && >> $hookdir/initqueue/work
exit 0

View File

@@ -1,40 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# do not add this module by default
return 255
}
depends() {
return 0
}
install() {
local _i
local _installs
if type -P rsyslogd >/dev/null; then
_installs="rsyslogd"
inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so
elif type -P syslogd >/dev/null; then
_installs="syslogd"
elif type -P syslog-ng >/dev/null; then
_installs="syslog-ng"
else
derror "Could not find any syslog binary although the syslogmodule" \
"is selected to be installed. Please check."
fi
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_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
dracut_need_initqueue
}

View File

@@ -1,51 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Triggered by udev and starts rsyslogd with bootparameters
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
rsyslog_config() {
local server=$1
shift
local syslog_template=$1
shift
local filters=$*
local filter=
local confline=
cat $syslog_template
# for filter in $filters; do
# echo "${filter} @${server}"
# done
if [ -n "$filters" ];then
confline="${filters}";
else
confline="*.*"
fi
if [ -n "$server" ];then
confline="$confline @${server}"
else
confline="$confline /var/log/messages"
fi
echo "$confline"
# echo "*.* /tmp/syslog"
}
read server < /tmp/syslog.server
read filters < /tmp/syslog.filters
[ -z "$filters" ] && filters="kern.*"
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 -i /var/run/syslogd.pid
fi

View File

@@ -1,34 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=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
#printf 'ATTR{operstate}!="down", SUBSYSTEM=="net", RUN+="/sbin/initqueue --onetime /sbin/'${syslogtype}'-start $env{INTERFACE}"\n' > /etc/udev/rules.d/70-syslog.rules
/sbin/initqueue --online --onetime /sbin/${syslogtype}-start
else
warn "syslog-genrules: Could not find binary to start syslog of type \"$syslogtype\". Syslog will not be started."
fi

View File

@@ -964,22 +964,22 @@ sub mkinitrd_dracut {
$dracutmoduledir="$rootimg_dir/usr/lib/dracut/modules.d/";
}
if ($dracutver > "033") {
my $perm = (stat("$fullpath/$dracutdir/patch/initqueue.sh"))[2];
cp("$fullpath/$dracutdir/patch/initqueue.sh", $dracutmoduledir."99base/");
if ($dracutver >= "033") {
my $perm = (stat("$fullpath/$dracutdir/patch/base/initqueue.sh"))[2];
cp("$fullpath/$dracutdir/patch/base/initqueue.sh", $dracutmoduledir."99base/");
chmod($perm&07777, $dracutmoduledir."99base/"."initqueue.sh");
$perm = (stat("$fullpath/$dracutdir/patch/module-setup.sh"))[2];
cp("$fullpath/$dracutdir/patch/module-setup.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/module-setup.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/module-setup.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."module-setup.sh");
$perm = (stat("$fullpath/$dracutdir/patch/rsyslogd-start.sh"))[2];
cp("$fullpath/$dracutdir/patch/rsyslogd-start.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/rsyslogd-start.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/rsyslogd-start.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."rsyslogd-start.sh");
$perm = (stat("$fullpath/$dracutdir/patch/syslog-genrules.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog-genrules.sh", $dracutmoduledir."98syslog/");
$perm = (stat("$fullpath/$dracutdir/patch/syslog/syslog-genrules.sh"))[2];
cp("$fullpath/$dracutdir/patch/syslog/syslog-genrules.sh", $dracutmoduledir."98syslog/");
chmod($perm&07777, $dracutmoduledir."98syslog/"."syslog-genrules.sh");
}