mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 01:26:38 +00:00
place patches for different dracut modules into different directories;run logger when xcatdebugmode=1;eliminate error messgaes when xcatdebugmode=0
This commit is contained in:
parent
32267bc6b6
commit
8e8219f590
58
xCAT-server/share/xcat/netboot/sles/dracut_033/patch/base/initqueue.sh
Executable file
58
xCAT-server/share/xcat/netboot/sles/dracut_033/patch/base/initqueue.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/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
|
41
xCAT-server/share/xcat/netboot/sles/dracut_033/patch/syslog/module-setup.sh
Executable file
41
xCAT-server/share/xcat/netboot/sles/dracut_033/patch/syslog/module-setup.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/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_install logger
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
#!/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"
|
||||
}
|
||||
|
||||
[ -f /tmp/syslog.server ] && read server < /tmp/syslog.server
|
||||
[ -f /tmp/syslog.filters ] && read filters < /tmp/syslog.filters
|
||||
[ -z "$filters" ] && filters="kern.*"
|
||||
[ -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 -i /var/run/syslogd.pid
|
||||
fi
|
@ -0,0 +1,34 @@
|
||||
#!/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" ]
|
||||
}
|
||||
|
||||
[ -f /tmp/syslog.type ] && 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
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
logger -t xcat -p debug "running xcatroot...."
|
||||
|
||||
|
||||
NEWROOT=$3
|
||||
RWDIR=.statelite
|
||||
@ -18,10 +18,14 @@ if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
|
||||
xcatdebugmode="$(getarg xcatdebugmode=)"
|
||||
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "running xcatroot...."
|
||||
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
logger -t xcat -p debug "nodestatus: netbooting,reporting..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
@ -30,10 +34,10 @@ if [ ! -z "$imgurl" ]; then
|
||||
NFS=0
|
||||
FILENAME=${imgurl##*/}
|
||||
while [ ! -r "$FILENAME" ]; do
|
||||
logger -t xcat -p debug "downloading $imgurl...."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "downloading $imgurl...."
|
||||
echo Getting $imgurl...
|
||||
if ! wget $imgurl; then
|
||||
logger -t xcat -p debug "downloading $imgurl failed,retrying...."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...."
|
||||
rm -f $FILENAME
|
||||
sleep 27
|
||||
fi
|
||||
@ -64,7 +68,7 @@ if [ -r /rootimg.sfs ]; then
|
||||
mount --move /ro $NEWROOT/ro
|
||||
mount --move /rw $NEWROOT/rw
|
||||
elif [ -r /rootimg.gz ]; then
|
||||
logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...."
|
||||
echo Setting up RAM-root tmpfs.
|
||||
if [ -z $rootlimit ];then
|
||||
mount -t tmpfs -o mode=755 rootfs $NEWROOT
|
||||
@ -73,7 +77,7 @@ elif [ -r /rootimg.gz ]; then
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
logger -t xcat -p debug "Extracting root filesystem:"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "Extracting root filesystem:"
|
||||
echo -n "Extracting root filesystem:"
|
||||
if [ -x /bin/cpio ]; then
|
||||
gzip -cd /rootimg.gz |/bin/cpio -idum
|
||||
@ -81,7 +85,7 @@ elif [ -r /rootimg.gz ]; then
|
||||
gzip -cd /rootimg.gz |cpio -idum
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
logger -t xcat -p debug "Done...."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "Done...."
|
||||
echo Done
|
||||
elif [ -r /rootimg-statelite.gz ]; then
|
||||
echo Setting up RAM-root tmpfs for statelite mode.
|
||||
@ -206,18 +210,18 @@ elif [ -r /rootimg-statelite.gz ]; then
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
else
|
||||
logger -t xcat -p debug "Failed to download image, panicing in 5..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "Failed to download image, panicing in 5..."
|
||||
echo -n Failed to download image, panicing in 5...
|
||||
for i in 4 3 2 1 0; do
|
||||
/bin/sleep 1
|
||||
logger -t xcat -p debug "$i..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "$i..."
|
||||
echo -n $i...
|
||||
done
|
||||
|
||||
logger -t xcat -p debug "You're dead. rpower nodename reset to play again."
|
||||
logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?"
|
||||
logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop"
|
||||
logger -t xcat -p debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "You're dead. rpower nodename reset to play again."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs"
|
||||
echo
|
||||
echo "You're dead. rpower nodename reset to play again.
|
||||
|
||||
@ -258,7 +262,7 @@ if [ -z $STATEMNT ]; then
|
||||
netif=${lf#*.}
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
if [ ! -z "$ifname" ]; then
|
||||
@ -274,10 +278,10 @@ if [ -z $STATEMNT ]; then
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX ]; then
|
||||
logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX"
|
||||
touch $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
|
||||
fi
|
||||
logger -t xcat -p debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "writing $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX: DEVICE=$ETHX;BOOTPROTO=dhcp;HWADDR=$MACX;ONBOOT=yes"
|
||||
echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
|
||||
echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
|
||||
echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
|
||||
@ -285,18 +289,18 @@ if [ -z $STATEMNT ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
logger -t xcat -p debug "saving $NEWROOT/etc/resolv.conf"
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "saving $NEWROOT/etc/resolv.conf"
|
||||
cp /etc/resolv.conf "$NEWROOT/etc/"
|
||||
|
||||
if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then
|
||||
logger -t xcat -p debug "disable selinux ..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "disable selinux ..."
|
||||
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
|
||||
fi
|
||||
|
||||
logger -t xcat -p debug "setting hostname..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "setting hostname..."
|
||||
echo `hostname` > $NEWROOT/etc/hostname
|
||||
|
||||
logger -t xcat -p debug "exiting xcatroot..."
|
||||
[ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "exiting xcatroot..."
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user