mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
adadon the patch for dracut base module; add a patched initqueue function in syslog-genrules.sh,which can process and --online and --onetime options
This commit is contained in:
parent
ed3a3bdcda
commit
8ed5bcad80
@ -20,6 +20,69 @@ detect_syslog() {
|
||||
[ -n "$syslogtype" ]
|
||||
}
|
||||
|
||||
#the initqueue.sh shipped does not support --online option and
|
||||
#there are some problem when processing --onetime option
|
||||
#implement a patched initqueue function here, named initqueue_enhanced
|
||||
initqueue_enhanced() {
|
||||
local onetime=
|
||||
local qname=
|
||||
local unique=
|
||||
local name=
|
||||
local env=
|
||||
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
|
||||
|
||||
local job=
|
||||
if [ -z "$unique" ]; then
|
||||
job="${name}$$"
|
||||
else
|
||||
job="${name:-$1}"
|
||||
job=${job##*/}
|
||||
fi
|
||||
|
||||
local exe=
|
||||
exe=$1
|
||||
shift
|
||||
|
||||
[ -x "$exe" ] || exe=$(command -v $exe)
|
||||
if [ -z "$exe" ] ; then
|
||||
echo "Invalid command"
|
||||
return 1
|
||||
fi
|
||||
|
||||
{
|
||||
[ -n "$env" ] && echo "$env"
|
||||
echo "$exe $@"
|
||||
[ -n "$onetime" ] && echo "[ -e $hookdir/initqueue${qname}/${job}.sh ] && rm -f -- $hookdir/initqueue${qname}/${job}.sh"
|
||||
} > "/tmp/$$-${job}.sh"
|
||||
|
||||
mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
|
||||
[ -z "$qname" ] && >> $hookdir/initqueue/work
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -f /tmp/syslog.type ] && read syslogtype < /tmp/syslog.type
|
||||
if [ -z "$syslogtype" ]; then
|
||||
syslogtype=$(detect_syslog)
|
||||
@ -28,7 +91,7 @@ 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
|
||||
initqueue_enhanced --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
|
||||
|
@ -831,12 +831,7 @@ sub mkinitrd_dracut {
|
||||
|
||||
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/syslog/module-setup.sh"))[2];
|
||||
my $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");
|
||||
|
||||
|
@ -20,6 +20,69 @@ detect_syslog() {
|
||||
[ -n "$syslogtype" ]
|
||||
}
|
||||
|
||||
#the initqueue.sh shipped does not support --online option and
|
||||
#there are some problem when processing --onetime option
|
||||
#implement a patched initqueue function here, named initqueue_enhanced
|
||||
initqueue_enhanced() {
|
||||
local onetime=
|
||||
local qname=
|
||||
local unique=
|
||||
local name=
|
||||
local env=
|
||||
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
|
||||
|
||||
local job=
|
||||
if [ -z "$unique" ]; then
|
||||
job="${name}$$"
|
||||
else
|
||||
job="${name:-$1}"
|
||||
job=${job##*/}
|
||||
fi
|
||||
|
||||
local exe=
|
||||
exe=$1
|
||||
shift
|
||||
|
||||
[ -x "$exe" ] || exe=$(command -v $exe)
|
||||
if [ -z "$exe" ] ; then
|
||||
echo "Invalid command"
|
||||
return 1
|
||||
fi
|
||||
|
||||
{
|
||||
[ -n "$env" ] && echo "$env"
|
||||
echo "$exe $@"
|
||||
[ -n "$onetime" ] && echo "[ -e $hookdir/initqueue${qname}/${job}.sh ] && rm -f -- $hookdir/initqueue${qname}/${job}.sh"
|
||||
} > "/tmp/$$-${job}.sh"
|
||||
|
||||
mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
|
||||
[ -z "$qname" ] && >> $hookdir/initqueue/work
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -f /tmp/syslog.type ] && read syslogtype < /tmp/syslog.type
|
||||
if [ -z "$syslogtype" ]; then
|
||||
syslogtype=$(detect_syslog)
|
||||
@ -28,7 +91,7 @@ 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
|
||||
initqueue_enhanced --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
|
||||
|
@ -965,12 +965,8 @@ sub mkinitrd_dracut {
|
||||
}
|
||||
|
||||
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/syslog/module-setup.sh"))[2];
|
||||
my $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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user