mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-16 03:10:36 +00:00
Merge pull request #1520 from penguhyang/rhels6_mn_log_diskless
add syslog module to realize the log forward
This commit is contained in:
3
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/check
Executable file
3
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/check
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exit 0
|
22
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/install
Executable file
22
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/install
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
if which rsyslogd >/dev/null; then
|
||||
installs="rsyslogd /lib64/rsyslog/lmnet.so /lib64/rsyslog/imklog.so /lib64/rsyslog/imuxsock.so"
|
||||
elif which syslogd >/dev/null; then
|
||||
installs="syslogd"
|
||||
elif which syslog-ng >/dev/null; then
|
||||
installs="syslog-ng"
|
||||
else
|
||||
dwarn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
|
||||
fi
|
||||
if [ -n "$installs" ]; then
|
||||
dracut_install cat
|
||||
dracut_install logger
|
||||
dracut_install $installs
|
||||
inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh"
|
||||
inst_hook pre-udev 61 "$moddir/syslog-genrules.sh"
|
||||
inst_hook pre-pivot 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
|
21
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh
Executable file
21
xCAT-server/share/xcat/netboot/rh/dracut/patch/syslog/parse-syslog-opts.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offs
|
||||
et: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Parses the syslog commandline options
|
||||
#
|
||||
#Bootparameters:
|
||||
#syslogserver=ip Where to syslog to
|
||||
#sysloglevel=level What level has to be logged
|
||||
#syslogtype=rsyslog|syslog|syslogng
|
||||
# Don't auto detect syslog but set it
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
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
|
@ -16,9 +16,14 @@ if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
xcatdebugmode="$(getarg xcatdebugmode=)"
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "running xcatroot...."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
|
||||
|
||||
if [ "$NODESTATUS" != "0" ]; then
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
if [ ! -z "$imgurl" ]; then
|
||||
@ -26,8 +31,10 @@ if [ ! -z "$imgurl" ]; then
|
||||
NFS=0
|
||||
FILENAME=${imgurl##*/}
|
||||
while [ ! -r "$FILENAME" ]; do
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl...."
|
||||
echo Getting $imgurl...
|
||||
if ! wget $imgurl; then
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...."
|
||||
rm -f $FILENAME
|
||||
sleep 27
|
||||
fi
|
||||
@ -61,6 +68,7 @@ if [ -r /rootimg.sfs ]; then
|
||||
mount --move /ro $NEWROOT/ro
|
||||
mount --move /rw $NEWROOT/rw
|
||||
elif [ -r /rootimg.gz ]; then
|
||||
[ "$xcatdebugmode" > "0" ] && 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
|
||||
@ -69,6 +77,7 @@ elif [ -r /rootimg.gz ]; then
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
[ "$xcatdebugmode" > "0" ] && 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
|
||||
@ -76,6 +85,7 @@ elif [ -r /rootimg.gz ]; then
|
||||
gzip -cd /rootimg.gz |cpio -idum
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
|
||||
echo Done
|
||||
elif [ -r /rootimg.txz ]; then
|
||||
echo Setting up RAM-root tmpfs.
|
||||
@ -213,11 +223,18 @@ elif [ -r /rootimg-statelite.gz ]; then
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
else
|
||||
[ "$xcatdebugmode" > "0" ] && 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
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "$i..."
|
||||
echo -n $i...
|
||||
done
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "You're dead. rpower nodename reset to play again."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop"
|
||||
[ "$xcatdebugmode" > "0" ] && 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.
|
||||
|
||||
@ -239,6 +256,7 @@ if [ -z $STATEMNT ]; then
|
||||
netif=${lf#*.}
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
if [ ! -z "$ifname" ]; then
|
||||
@ -255,8 +273,10 @@ if [ -z $STATEMNT ]; then
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX"
|
||||
touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
[ "$xcatdebugmode" > "0" ] && 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-scripts/ifcfg-$ETHX
|
||||
echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
@ -264,12 +284,15 @@ if [ -z $STATEMNT ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$xcatdebugmode" > "0" ] && 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
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "disable selinux ..."
|
||||
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
|
||||
fi
|
||||
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "exiting xcatroot..."
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > /initqueue/xcat.sh
|
||||
# force udevsettle to break
|
||||
|
@ -26,7 +26,7 @@ xcatdebugmode="$(getarg xcatdebugmode=)"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
if [ "$NODESTATUS" != "0" ]; then
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
@ -895,19 +895,29 @@ sub mkinitrd_dracut {
|
||||
|
||||
|
||||
if ($dracutver >= "033") {
|
||||
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");
|
||||
|
||||
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");
|
||||
$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/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/syslog-genrules.sh"))[2];
|
||||
cp("$fullpath/$dracutdir/patch/syslog/syslog-genrules.sh", $dracutmoduledir."98syslog/");
|
||||
chmod($perm&07777, $dracutmoduledir."98syslog/"."syslog-genrules.sh");
|
||||
} else {
|
||||
my $perm = (stat("$fullpath/$dracutdir/patch/syslog/check"))[2];
|
||||
cp("$fullpath/$dracutdir/patch/syslog/check", $dracutmoduledir."98syslog/");
|
||||
chmod($perm&07777, $dracutmoduledir."98syslog/"."check");
|
||||
|
||||
$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");
|
||||
$perm = (stat("$fullpath/$dracutdir/patch/syslog/install"))[2];
|
||||
cp("$fullpath/$dracutdir/patch/syslog/install", $dracutmoduledir."98syslog/");
|
||||
chmod($perm&07777, $dracutmoduledir."98syslog/"."install");
|
||||
|
||||
$perm = (stat("$fullpath/$dracutdir/patch/syslog/parse-syslog-opts.sh"))[2];
|
||||
cp("$fullpath/$dracutdir/patch/syslog/parse-syslog-opts.sh", $dracutmoduledir."98syslog/");
|
||||
chmod($perm&07777, $dracutmoduledir."98syslog/"."parse-syslog-opts.sh");
|
||||
}
|
||||
|
||||
my $dracutmpath = $dracutmoduledir."97xcat/";
|
||||
@ -955,10 +965,10 @@ sub mkinitrd_dracut {
|
||||
#update etc/dracut.conf
|
||||
open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf");
|
||||
if (-d glob($dracutmoduledir."[0-9]*fadump")){
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules fadump"\n};
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules syslog fadump"\n};
|
||||
}
|
||||
else{
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules"\n};
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules syslog"\n};
|
||||
}
|
||||
print $DRACUTCONF qq{add_drivers+="$add_drivers"\n};
|
||||
print $DRACUTCONF qq{filesystems+="nfs"\n};
|
||||
@ -991,16 +1001,12 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/installkernel"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/installkernel");
|
||||
|
||||
my $dracutmodulelist=" xcat nfs base network kernel-modules ";
|
||||
my $dracutmodulelist=" xcat nfs base network kernel-modules syslog ";
|
||||
if (-d glob($dracutmoduledir."[0-9]*fadump")){
|
||||
$dracutmodulelist .=" fadump ";
|
||||
|
||||
}
|
||||
|
||||
if ($dracutver >= "033") {
|
||||
$dracutmodulelist .= " syslog ";
|
||||
}
|
||||
|
||||
# update etc/dracut.conf
|
||||
open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf");
|
||||
print $DRACUTCONF qq{dracutmodules+="$dracutmodulelist"\n};
|
||||
|
Reference in New Issue
Block a user