mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-24 12:10:25 +00:00
Provide RHEL7->RHEL8 diskless support (#5567)
* Package lists and post-install scripts for RHEL8 diskless support * RHEL8 kernel finding hack * Subdirectory dracut_047 for RHEL8 support * Use /bin/bash for all the scripts * Use "set -x" for debugging * Tweak dracut.conf * Remove dracut-install
This commit is contained in:
1
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64.exlist
Symbolic link
1
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64.exlist
Symbolic link
@@ -0,0 +1 @@
|
||||
compute.rhels8.ppc64le.exlist
|
1
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64.pkglist
Symbolic link
1
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64.pkglist
Symbolic link
@@ -0,0 +1 @@
|
||||
compute.rhels8.ppc64le.pkglist
|
@@ -0,0 +1 @@
|
||||
compute.rhels8.ppc64le.postinstall
|
@@ -0,0 +1,32 @@
|
||||
./boot*
|
||||
./usr/include*
|
||||
./usr/lib/locale*
|
||||
./usr/lib64/perl5/Encode/CN*
|
||||
./usr/lib64/perl5/Encode/JP*
|
||||
./usr/lib64/perl5/Encode/TW*
|
||||
./usr/lib64/perl5/Encode/KR*
|
||||
./lib/kbd/keymaps/i386*
|
||||
./lib/kbd/keymaps/mac*
|
||||
./lib/kbd/keymaps/include*
|
||||
./usr/local/include*
|
||||
./usr/local/share/man*
|
||||
./usr/share/man*
|
||||
./usr/share/cracklib*
|
||||
./usr/share/doc*
|
||||
./usr/share/gnome*
|
||||
./usr/share/i18n*
|
||||
+./usr/share/i18n/en_US*
|
||||
./usr/share/info*
|
||||
./usr/share/locale/*
|
||||
+./usr/share/locale/en_US*
|
||||
+./usr/share/locale/C*
|
||||
+./usr/share/locale/locale.alias
|
||||
+./usr/lib/locale/locale-archive
|
||||
+./usr/lib/locale/en*
|
||||
./usr/share/omf*
|
||||
./usr/share/vim/site/doc*
|
||||
./usr/share/vim/vim74/doc*
|
||||
./usr/share/zoneinfo*
|
||||
./var/cache/man*
|
||||
./var/lib/yum*
|
||||
./tmp*
|
@@ -0,0 +1,33 @@
|
||||
bash
|
||||
bc
|
||||
bzip2
|
||||
chrony
|
||||
coreutils
|
||||
curl
|
||||
dhcp-client
|
||||
dracut
|
||||
dracut-network
|
||||
e2fsprogs
|
||||
ethtool
|
||||
file
|
||||
gzip
|
||||
hostname
|
||||
iputils
|
||||
irqbalance
|
||||
kernel
|
||||
lsvpd
|
||||
net-tools
|
||||
nfs-utils
|
||||
openssh-clients
|
||||
openssh-server
|
||||
openssl
|
||||
parted
|
||||
ppc64-utils
|
||||
procps-ng
|
||||
rpm
|
||||
rsync
|
||||
rsyslog
|
||||
tar
|
||||
util-linux
|
||||
vim-minimal
|
||||
xz
|
50
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall
Executable file
50
xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
#-- Do not remove following line if you want to make use of CVS version tracking
|
||||
#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $
|
||||
#-- jurij.sikorsky@t-systems.cz
|
||||
#--
|
||||
#-- this script is run after all packages from $profile.pkglist are installed
|
||||
#--
|
||||
#-- it gets these arguments:
|
||||
#--
|
||||
#-- $1 = install root (chroot directory for profile)
|
||||
#-- $2 = OS version
|
||||
#-- $3 = architecture
|
||||
#-- $4 = profile name
|
||||
#-- $5 = work dir (where genimage is located)
|
||||
#--
|
||||
#--
|
||||
installroot=$1
|
||||
osver=$2
|
||||
arch=$3
|
||||
profile=$4
|
||||
workdir=$5
|
||||
|
||||
#-- Example how /etc/fstab can be automatically generated during image generation:
|
||||
cat <<END >$installroot/etc/fstab
|
||||
proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
END
|
||||
|
||||
|
||||
#-- Uncomment the line contains "cons" in /etc/inittab
|
||||
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
|
||||
echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
|
||||
|
||||
#-- Disable SELinux in the rootimg
|
||||
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
|
||||
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
|
||||
if [ -f "$installroot/etc/selinux/config" ]
|
||||
then
|
||||
sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config
|
||||
fi
|
||||
|
||||
#-- Example of booted image versioning
|
||||
#-- We want to know, with what configuration (version of the image) each node was booted.
|
||||
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
|
||||
#cat /dev/null > $installroot/etc/IMGVERSION
|
||||
#for ext in pkglist exlist postinstall repolist; do
|
||||
# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION
|
||||
#done
|
||||
|
@@ -0,0 +1,33 @@
|
||||
./boot*
|
||||
./usr/include*
|
||||
./usr/lib/locale*
|
||||
./usr/lib64/perl5/Encode/CN*
|
||||
./usr/lib64/perl5/Encode/JP*
|
||||
./usr/lib64/perl5/Encode/TW*
|
||||
./usr/lib64/perl5/Encode/KR*
|
||||
./lib/kbd/keymaps/i386*
|
||||
./lib/kbd/keymaps/mac*
|
||||
./lib/kdb/keymaps/include*
|
||||
./usr/local/include*
|
||||
./usr/local/share/man*
|
||||
./usr/share/man*
|
||||
./usr/share/cracklib*
|
||||
./usr/share/doc*
|
||||
./usr/share/gnome*
|
||||
./usr/share/i18n*
|
||||
+./usr/share/i18n/en_US*
|
||||
./usr/share/info*
|
||||
./usr/share/locale/*
|
||||
+./usr/share/locale/en_US*
|
||||
+./usr/share/locale/C*
|
||||
+./usr/share/locale/locale.alias
|
||||
+./usr/lib/locale/locale-archive
|
||||
+./usr/lib/locale/en*
|
||||
./usr/share/man*
|
||||
./usr/share/omf*
|
||||
./usr/share/vim/site/doc*
|
||||
./usr/share/vim/vim74/doc*
|
||||
./usr/share/zoneinfo*
|
||||
./var/cache/man*
|
||||
./var/lib/yum*
|
||||
./tmp*
|
@@ -0,0 +1,31 @@
|
||||
bash
|
||||
bc
|
||||
bzip2
|
||||
chrony
|
||||
coreutils
|
||||
curl
|
||||
dhcp-client
|
||||
dracut
|
||||
dracut-network
|
||||
e2fsprogs
|
||||
ethtool
|
||||
file
|
||||
gzip
|
||||
hostname
|
||||
iputils
|
||||
irqbalance
|
||||
kernel
|
||||
net-tools
|
||||
nfs-utils
|
||||
openssh-clients
|
||||
openssh-server
|
||||
openssl
|
||||
parted
|
||||
procps-ng
|
||||
rpm
|
||||
rsync
|
||||
rsyslog
|
||||
tar
|
||||
util-linux
|
||||
vim-minimal
|
||||
xz
|
50
xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall
Executable file
50
xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
#-- Do not remove following line if you want to make use of CVS version tracking
|
||||
#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $
|
||||
#-- jurij.sikorsky@t-systems.cz
|
||||
#--
|
||||
#-- this script is run after all packages from $profile.pkglist are installed
|
||||
#--
|
||||
#-- it gets these arguments:
|
||||
#--
|
||||
#-- $1 = install root (chroot directory for profile)
|
||||
#-- $2 = OS version
|
||||
#-- $3 = architecture
|
||||
#-- $4 = profile name
|
||||
#-- $5 = work dir (where genimage is located)
|
||||
#--
|
||||
#--
|
||||
installroot=$1
|
||||
osver=$2
|
||||
arch=$3
|
||||
profile=$4
|
||||
workdir=$5
|
||||
|
||||
#-- Example how /etc/fstab can be automatically generated during image generation:
|
||||
cat <<END >$installroot/etc/fstab
|
||||
proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
END
|
||||
|
||||
#-- Uncomment the line contains "cons" in /etc/inittab
|
||||
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
|
||||
#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
|
||||
|
||||
|
||||
#-- Disable SELinux in the rootimg
|
||||
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
|
||||
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
|
||||
if [ -f "$installroot/etc/selinux/config" ]
|
||||
then
|
||||
sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config
|
||||
fi
|
||||
|
||||
#-- Example of booted image versioning
|
||||
#-- We want to know, with what configuration (version of the image) each node was booted.
|
||||
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
|
||||
#cat /dev/null > $installroot/etc/IMGVERSION
|
||||
#for ext in pkglist exlist postinstall repolist; do
|
||||
# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION
|
||||
#done
|
||||
|
3
xCAT-server/share/xcat/netboot/rh/dracut_047/check
Executable file
3
xCAT-server/share/xcat/netboot/rh/dracut_047/check
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
[ "$1" = "-d" ] && echo network
|
||||
exit 0
|
13
xCAT-server/share/xcat/netboot/rh/dracut_047/install.netboot
Executable file
13
xCAT-server/share/xcat/netboot/rh/dracut_047/install.netboot
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
echo $drivers
|
||||
dracut_install curl tar cpio gzip modprobe touch echo cut wc xz
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install mount.nfs
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
dracut_install ethtool
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
inst "$moddir/xcatroot" "/sbin/xcatroot"
|
||||
inst_hook cmdline 10 "$moddir/xcat-cmdline.sh"
|
||||
for file in /etc/udev/rules.d/*;do
|
||||
grep -qi xcat $file && inst_rules $(basename $file)
|
||||
done
|
12
xCAT-server/share/xcat/netboot/rh/dracut_047/install.statelite
Executable file
12
xCAT-server/share/xcat/netboot/rh/dracut_047/install.statelite
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
echo $drivers
|
||||
dracut_install curl cpio gzip modprobe wc touch echo cut
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
dracut_install ethtool
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
inst_hook pre-mount 5 "$moddir/xcat-premount.sh"
|
||||
inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh"
|
||||
for file in /etc/udev/rules.d/*;do
|
||||
grep -qi xcat $file && inst_rules $(basename $file)
|
||||
done
|
2
xCAT-server/share/xcat/netboot/rh/dracut_047/installkernel
Executable file
2
xCAT-server/share/xcat/netboot/rh/dracut_047/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc
|
41
xCAT-server/share/xcat/netboot/rh/dracut_047/patch/syslog/module-setup.sh
Executable file
41
xCAT-server/share/xcat/netboot/rh/dracut_047/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 rsyslog/imjournal.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
|
||||
}
|
||||
|
56
xCAT-server/share/xcat/netboot/rh/dracut_047/patch/syslog/rsyslogd-start.sh
Executable file
56
xCAT-server/share/xcat/netboot/rh/dracut_047/patch/syslog/rsyslogd-start.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/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
|
||||
|
||||
# In dracut 33, default rsyslogd configuration does not use journald. Then when
|
||||
# rsyslog in debug mode, it causes `/dev/log` is not available after switch_root (#4929)
|
||||
echo "\$ModLoad imjournal"
|
||||
echo "\$OmitLocalLogging on"
|
||||
echo "\$IMJournalStateFile imjournal.state"
|
||||
|
||||
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
|
97
xCAT-server/share/xcat/netboot/rh/dracut_047/patch/syslog/syslog-genrules.sh
Executable file
97
xCAT-server/share/xcat/netboot/rh/dracut_047/patch/syslog/syslog-genrules.sh
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/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" ]
|
||||
}
|
||||
|
||||
#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)
|
||||
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
|
||||
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
|
@@ -0,0 +1,4 @@
|
||||
root=1
|
||||
rootok=1
|
||||
netroot=xcat
|
||||
echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/xcatroot.sh
|
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
#script to update nodelist.nodestatus during provision
|
||||
|
||||
XCAT="$(getarg XCAT=)"
|
||||
STATEMNT="$(getarg STATEMNT=)"
|
||||
MASTER=`echo $XCAT |awk -F: '{print $1}'`
|
||||
|
||||
getarg nonodestatus
|
||||
NODESTATUS=$?
|
||||
|
||||
XCATIPORT="$(getarg XCATIPORT=)"
|
||||
if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
177
xCAT-server/share/xcat/netboot/rh/dracut_047/xcat-prepivot.sh
Executable file
177
xCAT-server/share/xcat/netboot/rh/dracut_047/xcat-prepivot.sh
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
NEWROOT=/sysroot
|
||||
SERVER=${SERVER%%/*}
|
||||
SERVER=${SERVER%:}
|
||||
RWDIR=.statelite
|
||||
XCAT="$(getarg XCAT=)"
|
||||
STATEMNT="$(getarg STATEMNT=)"
|
||||
if [ ! -z $STATEMNT ]; then #btw, uri style might have left future options other than nfs open, will u se // to detect uri in the future I guess
|
||||
SNAPSHOTSERVER=${STATEMNT%:*}
|
||||
SNAPSHOTROOT=${STATEMNT#*/}
|
||||
#echo $SNAPSHOTROOT
|
||||
#echo $SNAPSHOTSERVER
|
||||
# may be that there is not server and just a directory.
|
||||
if [ -z $SNAPSHOTROOT ]; then
|
||||
SNAPSHOTROOT=$SNAPSHOTSERVER
|
||||
SNAPSHOTSERVER=
|
||||
fi
|
||||
fi
|
||||
|
||||
echo Setting up Statelite
|
||||
mkdir -p $NEWROOT
|
||||
|
||||
# now we need to mount the rest of the system. This is the read/write portions
|
||||
# echo Mounting snapshot directories
|
||||
|
||||
MAXTRIES=7
|
||||
ITER=0
|
||||
if [ ! -e "$NEWROOT/$RWDIR" ]; then
|
||||
echo ""
|
||||
echo "This NFS root directory doesn't have a /$RWDIR directory for me to mount a rw filesystem. You'd better create it... "
|
||||
echo ""
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then
|
||||
echo ""
|
||||
echo "$NEWROOT/etc/init.d/statelite doesn't exist. Perhaps you didn't create this image with th e -m statelite mode"
|
||||
echo ""
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
mount -t tmpfs rw $NEWROOT/$RWDIR
|
||||
mkdir -p $NEWROOT/$RWDIR/tmpfs
|
||||
ME=`hostname -s`
|
||||
if [ ! -z $NODE ]; then
|
||||
ME=$NODE
|
||||
fi
|
||||
|
||||
# mount the SNAPSHOT directory here for persistent use.
|
||||
if [ ! -z $SNAPSHOTSERVER ]; then
|
||||
mkdir -p $NEWROOT/$RWDIR/persistent
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
if [ -z $MNTOPTS ]; then
|
||||
MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14"
|
||||
else
|
||||
MNT_OPTIONS=$MNTOPTS
|
||||
fi
|
||||
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "Your are dead, rpower $ME boot to play again."
|
||||
echo "Possible problems:
|
||||
1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ?
|
||||
2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds..."
|
||||
sleep $RS
|
||||
done
|
||||
|
||||
# create directory which is named after my node name
|
||||
mkdir -p $NEWROOT/$RWDIR/persistent/$ME
|
||||
ITER=0
|
||||
# umount current persistent mount
|
||||
while ! umount -l $NEWROOT/$RWDIR/persistent; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "Your are dead, rpower $ME boot to play again."
|
||||
echo "Cannot umount $NEWROOT/$RWDIR/persistent."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds..."
|
||||
sleep $RS
|
||||
done
|
||||
|
||||
# mount persistent to server:/rootpath/nodename
|
||||
ITER=0
|
||||
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "Your are dead, rpower $ME boot to play again."
|
||||
echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds..."
|
||||
sleep $RS
|
||||
done
|
||||
fi
|
||||
|
||||
# TODO: handle the dhclient/resolv.conf/ntp, etc
|
||||
echo "Get to enable localdisk"
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
$NEWROOT/etc/init.d/statelite
|
||||
READONLY=yes
|
||||
export READONLY
|
||||
fastboot=yes
|
||||
export fastboot
|
||||
keep_old_ip=yes
|
||||
export keep_old_ip
|
||||
mount -n --bind /dev $NEWROOT/dev
|
||||
mount -n --bind /proc $NEWROOT/proc
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
function getdevfrommac() {
|
||||
boothwaddr=$1
|
||||
ip link show | while read line
|
||||
do
|
||||
dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1`
|
||||
if [ "X$dev" != "X" ]; then
|
||||
devname=$dev
|
||||
fi
|
||||
|
||||
if [ "X$devname" != "X" ]; then
|
||||
hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'`
|
||||
if [ "X$hwaddr" = "X$boothwaddr" ]; then
|
||||
echo $devname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
for lf in /tmp/dhclient.*.lease; do
|
||||
netif=${lf#*.}
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
if [ ! -z "$ifname" ]; then
|
||||
MACX=${ifname#*:}
|
||||
ETHX=${ifname%:$MACX*}
|
||||
elif [ ! -z "$netdev" ]; then
|
||||
ETHX=$netdev
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=$(getdevfrommac $BOOTIF)
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
||||
touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
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
|
||||
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
|
||||
cp /etc/resolv.conf "$NEWROOT/etc/"
|
||||
|
||||
if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then
|
||||
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
|
||||
fi
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
367
xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot
Executable file
367
xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot
Executable file
@@ -0,0 +1,367 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
log_label="xcat.deployment"
|
||||
|
||||
NEWROOT=$3
|
||||
RWDIR=.statelite
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
XCAT="$(getarg XCAT=)"
|
||||
XCATMASTER=$XCAT
|
||||
STATEMNT="$(getarg STATEMNT=)"
|
||||
rootlimit="$(getarg rootlimit=)"
|
||||
xcatdebugmode="$(getarg xcatdebugmode=)"
|
||||
rflags="$(getarg rootflags=)"
|
||||
getarg nonodestatus
|
||||
NODESTATUS=$?
|
||||
|
||||
MASTER=`echo $XCATMASTER |awk -F: '{print $1}'`
|
||||
XCATIPORT="$(getarg XCATIPORT=)"
|
||||
if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
[ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER"
|
||||
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Executing xcatroot to prepare for netbooting (dracut_33)..."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT NODESTATUS=$NODESTATUS"
|
||||
|
||||
if [ "$NODESTATUS" != "0" ]; then
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Sending request to $MASTER:$XCATIPORT for changing status to netbooting..."
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
|
||||
imgurl="$(getarg imgurl=)";
|
||||
if [ ! -z "$imgurl" ]; then
|
||||
if [ xhttp = x${imgurl%%:*} ]; then
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Downloading rootfs image from $imgurl..."
|
||||
NFS=0
|
||||
FILENAME=${imgurl##*/}
|
||||
while [ ! -r "$FILENAME" ]; do
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Downloading $imgurl..."
|
||||
echo Getting $imgurl...
|
||||
if ! curl --fail $imgurl -o $FILENAME; then
|
||||
logger $SYSLOGHOST -t $log_label -p local4.error "Downloading $imgurl FAILED, retrying..."
|
||||
rm -f $FILENAME
|
||||
echo Failed to get the image, waiting for next retrying...
|
||||
sleep 27
|
||||
fi
|
||||
done
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Download complete."
|
||||
elif [ xnfs = x${imgurl%%:*} ]; then
|
||||
NFS=1
|
||||
SERVER=${imgurl#nfs:}
|
||||
SERVER=${SERVER#/}
|
||||
SERVER=${SERVER#/}
|
||||
ROOTDIR=$SERVER
|
||||
SERVER=${SERVER%%/*}
|
||||
SERVER=${SERVER%:}
|
||||
ROOTDIR=/${ROOTDIR#*/}
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "SERVER=$SERVER ROOTDIR=$ROOTDIR"
|
||||
fi
|
||||
fi
|
||||
#echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug
|
||||
|
||||
if [ -r /rootimg.sfs ]; then
|
||||
echo Setting up squashfs with ram overlay.
|
||||
mknod /dev/loop0 b 7 0
|
||||
mkdir -p /ro
|
||||
mkdir -p /rw
|
||||
mount -t squashfs /rootimg.sfs /ro
|
||||
mount -t tmpfs rw /rw
|
||||
mount -t aufs -o dirs=/rw:/ro mergedroot $NEWROOT
|
||||
mkdir -p $NEWROOT/ro
|
||||
mkdir -p $NEWROOT/rw
|
||||
mount --move /ro $NEWROOT/ro
|
||||
mount --move /rw $NEWROOT/rw
|
||||
elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Setting up RAM-root tmpfs on downloaded rootimg.cpio.[gz/xz]..."
|
||||
echo Setting up RAM-root tmpfs.
|
||||
rootopts="mode=755"
|
||||
if [ -n "$rflags" ]; then
|
||||
rootopts="$rootopts","$rflags"
|
||||
fi
|
||||
if [ -z "$rootlimit" ];then
|
||||
mount -t tmpfs -o $rootopts rootfs $NEWROOT
|
||||
else
|
||||
mount -t tmpfs -o "$rootopts",size=$rootlimit rootfs $NEWROOT
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting the root filesystem..."
|
||||
echo "Extracting the root filesystem..."
|
||||
if [ -r /rootimg.cpio.gz ]; then
|
||||
if [ -x /bin/cpio ]; then
|
||||
gzip -cd /rootimg.cpio.gz |/bin/cpio -idum
|
||||
else
|
||||
gzip -cd /rootimg.cpio.gz |cpio -idum
|
||||
fi
|
||||
elif [ -r /rootimg.cpio.xz ]; then
|
||||
if [ -x /bin/cpio ]; then
|
||||
xz -cd /rootimg.cpio.xz |/bin/cpio -idum
|
||||
else
|
||||
xz -cd /rootimg.cpio.xz |cpio -idum
|
||||
fi
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Done extracting the root filesystem..."
|
||||
echo "Done extracting the root filesystem..."
|
||||
elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Setting up RAM-root tmpfs on downloaded rootimg.tar.[gz/xz]..."
|
||||
echo Setting up RAM-root tmpfs.
|
||||
if [ -z $rootlimit ];then
|
||||
mount -t tmpfs -o mode=755 rootfs $NEWROOT
|
||||
else
|
||||
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Extracting the root filesystem..."
|
||||
echo "Extracting the root filesystem..."
|
||||
if [ -r /rootimg.tar.gz ]; then
|
||||
tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz
|
||||
if [ $? -ne 0 ]; then
|
||||
tar --selinux -zxf /rootimg.tar.gz
|
||||
fi
|
||||
elif [ -r /rootimg.tar.xz ]; then
|
||||
tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz
|
||||
if [ $? -ne 0 ]; then
|
||||
tar --selinux -Jxf /rootimg.tar.xz
|
||||
fi
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
msg="Done extracting the root filesystem."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$msg"
|
||||
echo "$msg"
|
||||
elif [ -r /rootimg-statelite.gz ]; then
|
||||
msg="Setting up RAM-root tmpfs for statelite mode."
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "$msg"
|
||||
echo "$msg"
|
||||
|
||||
if [ -z $rootlimit];then
|
||||
mount -t tmpfs -o mode=755 rootfs $NEWROOT
|
||||
else
|
||||
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
msg="Extracting root filesystem..."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$msg"
|
||||
echo "$msg"
|
||||
if [ -x /bin/cpio ]; then
|
||||
gzip -cd /rootimg-statelite.gz |/bin/cpio -idum
|
||||
else
|
||||
gzip -cd /rootimg-statelite.gz |cpio -idum
|
||||
fi
|
||||
msg="Done extracting the root filesystem."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$msg"
|
||||
echo "$msg"
|
||||
# then, the statelite staffs will be processed
|
||||
msg="Setting up Statelite..."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$msg"
|
||||
echo "$msg"
|
||||
|
||||
modprobe nfs
|
||||
MAXTRIES=7
|
||||
ITER=0
|
||||
if [ ! -e "$NEWROOT/$RWDIR" ]; then
|
||||
echo ""
|
||||
echo "The /$RWDIR directory doesn't exist in the rootimg... "
|
||||
echo ""
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then
|
||||
echo ""
|
||||
echo "$NEWROOT/etc/init.d/statelite doesn't exist... "
|
||||
echo ""
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
mount -t tmpfs rw $NEWROOT/$RWDIR
|
||||
mkdir -p $NEWROOT/$RWDIR/tmpfs
|
||||
ME=`hostname -s`
|
||||
if [ ! -z $NODE ]; then
|
||||
ME=$NODE
|
||||
fi
|
||||
|
||||
|
||||
# mount the SNAPSHOT directory here for persistent use.
|
||||
if [ ! -z $STATEMNT ]; then
|
||||
SNAPSHOTSERVER=${STATEMNT%:*}
|
||||
SNAPSHOTROOT=${STATEMNT#*/}
|
||||
if [ -z $SNAPSHOTROOT ]; then
|
||||
SNAPSHOTROOT=$SNAPSHOTSERVER
|
||||
SNAPSHOTSERVER=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z $SNAPSHOTSERVER ]; then
|
||||
mkdir -p $NEWROOT/$RWDIR/persistent
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
if [ -z $MNTOPTS ]; then
|
||||
MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14"
|
||||
else
|
||||
MNT_OPTIONS=$MNTOPTS
|
||||
fi
|
||||
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "You are dead, rpower $ME boot to play again."
|
||||
echo "Possible problems:
|
||||
1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ?
|
||||
2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds ..."
|
||||
sleep $RS
|
||||
done
|
||||
|
||||
# create directory which is named after my node name
|
||||
mkdir -p $NEWROOT/$RWDIR/persistent/$ME
|
||||
ITER=0
|
||||
# umount current persistent mount
|
||||
while ! umount -l $NEWROOT/$RWDIR/persistent; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "Your are dead, rpower $ME boot to play again."
|
||||
echo "Cannot umount $NEWROOT/$RWDIR/persistent."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds..."
|
||||
sleep $RS
|
||||
done
|
||||
|
||||
# mount persistent to server:/rootpath/nodename
|
||||
ITER=0
|
||||
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
|
||||
ITER=$(( ITER + 1 ))
|
||||
if [ "$ITER" == "$MAXTRIES" ]; then
|
||||
echo "Your are dead, rpower $ME boot to play again."
|
||||
echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME."
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
RS=$(( $RANDOM % 20 ))
|
||||
echo "Trying again in $RS seconds..."
|
||||
sleep $RS
|
||||
done
|
||||
fi
|
||||
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
$NEWROOT/etc/init.d/statelite
|
||||
fastboot=yes
|
||||
export fastboot
|
||||
keep_old_ip=yes
|
||||
export keep_old_ip
|
||||
|
||||
mount -n --bind /dev $NEWROOT/dev
|
||||
mount -n --bind /proc $NEWROOT/proc
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
else
|
||||
msg="Failed to download image, panic in 5..."
|
||||
logger $SYSLOGHOST -t $log_label -p local4.error "$msg"
|
||||
echo -n "$msg"
|
||||
for i in 4 3 2 1 0; do
|
||||
/bin/sleep 1
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "$i..."
|
||||
echo -n $i...
|
||||
done
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "You're dead. rpower nodename reset to play again."
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.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.
|
||||
|
||||
* Did you packimage with -m cpio, -m squashfs, or -m nfs?
|
||||
* If using -m squashfs did you include aufs.ko with geninitrd?
|
||||
e.g.: -n tg3,squashfs,aufs,loop
|
||||
* 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
|
||||
|
||||
"
|
||||
/bin/sh
|
||||
exit
|
||||
fi
|
||||
cd /
|
||||
|
||||
function getdevfrommac() {
|
||||
boothwaddr=$1
|
||||
ip link show | while read line
|
||||
do
|
||||
dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1`
|
||||
if [ "X$dev" != "X" ]; then
|
||||
devname=$dev
|
||||
fi
|
||||
|
||||
if [ "X$devname" != "X" ]; then
|
||||
hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'`
|
||||
if [ "X$hwaddr" = "X$boothwaddr" ]; then
|
||||
echo $devname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -z $STATEMNT ]; then
|
||||
for lf in /tmp/dhclient.*.lease; do
|
||||
netif=${lf#*.}
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
ifname="$(getarg ifname=)"
|
||||
netdev="$(getarg netdev=)"
|
||||
BOOTIF="$(getarg BOOTIF=)"
|
||||
if [ ! -z "$ifname" ]; then
|
||||
MACX=${ifname#*:}
|
||||
ETHX=${ifname%:$MACX*}
|
||||
elif [ ! -z "$netdev" ]; then
|
||||
ETHX=$netdev
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
MACX=${MACX#01-}
|
||||
MACX=${MACX//-/:}
|
||||
ETHX=$(getdevfrommac $MACX)
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "Creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX"
|
||||
touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.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
|
||||
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.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 $log_label -p local4.debug "disable selinux ..."
|
||||
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
|
||||
fi
|
||||
|
||||
logger $SYSLOGHOST -t $log_label -p local4.info "Exiting xcatroot..."
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
@@ -679,6 +679,8 @@ if (-e "$rootimg_dir/boot/vmlinux-$kernelver") {
|
||||
cp("$rootimg_dir/boot/vmlinuz-$kernelver", "$destdir/kernel");
|
||||
} elsif (-e "$rootimg_dir/boot/image-$kernelver") {
|
||||
cp("$rootimg_dir/boot/image-$kernelver", "$destdir/kernel");
|
||||
} elsif (-e "$rootimg_dir/lib/modules/$kernelver/vmlinuz") {
|
||||
cp("$rootimg_dir/lib/modules/$kernelver/vmlinuz", "$destdir/kernel");
|
||||
} else {
|
||||
xdie("couldn't find the kernel file matched $kernelver in $rootimg_dir/boot");
|
||||
}
|
||||
@@ -747,7 +749,9 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut"))
|
||||
$dracutver = `rpm --root $rootimg_dir -qi dracut | grep Version | awk -F' ' '{print \$3}'`;
|
||||
chomp($dracutver);
|
||||
if ($dracutver =~ /^\d\d\d$/) {
|
||||
if ($dracutver >= "033") {
|
||||
if ($dracutver >= "047") {
|
||||
$dracutdir = "dracut_047";
|
||||
} elsif ($dracutver >= "033") {
|
||||
$dracutdir = "dracut_033";
|
||||
} else {
|
||||
$dracutdir = "dracut"; # The default directory
|
||||
@@ -1012,7 +1016,7 @@ sub mkinitrd_dracut {
|
||||
chmod($perm & 07777, $dracutmoduledir . "98syslog/" . "parse-syslog-opts.sh");
|
||||
}
|
||||
|
||||
my $dracutmpath = $dracutmoduledir . "97xcat/";
|
||||
my $dracutmpath = $dracutmoduledir . "98xcat/";
|
||||
mkpath($dracutmpath);
|
||||
|
||||
my $perm = (stat("$fullpath/$dracutdir/check"))[2];
|
||||
@@ -1059,14 +1063,13 @@ sub mkinitrd_dracut {
|
||||
|
||||
#update etc/dracut.conf
|
||||
open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf");
|
||||
my $dracutmodulelist = "xcat nfs base network kernel-modules syslog ";
|
||||
my $dracutmodulelist = "xcat nfs base network kernel-modules syslog";
|
||||
|
||||
if (-d glob($dracutmoduledir . "[0-9]*systemd")) {
|
||||
$dracutmodulelist .= " systemd ";
|
||||
}
|
||||
|
||||
if (-d glob($dracutmoduledir . "[0-9]*fadump")) {
|
||||
$dracutmodulelist .= " fadump ";
|
||||
foreach (qw/systemd systemd-initrd dracut-systemd fadump/) {
|
||||
my ($dir) = glob($dracutmoduledir . "[0-9]*" . $_);
|
||||
if (-d $dir) {
|
||||
$dracutmodulelist .= " $_";
|
||||
}
|
||||
}
|
||||
|
||||
print $DRACUTCONF qq{dracutmodules+="$dracutmodulelist"\n};
|
||||
@@ -1101,15 +1104,13 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/installkernel"))[2];
|
||||
chmod($perm & 07777, "$dracutmpath/installkernel");
|
||||
|
||||
my $dracutmodulelist = " xcat nfs base network kernel-modules syslog ";
|
||||
my $dracutmodulelist = "xcat nfs base network kernel-modules syslog";
|
||||
|
||||
|
||||
if (-d glob($dracutmoduledir . "[0-9]*systemd")) {
|
||||
$dracutmodulelist .= " systemd ";
|
||||
}
|
||||
|
||||
if (-d glob($dracutmoduledir . "[0-9]*fadump")) {
|
||||
$dracutmodulelist .= " fadump ";
|
||||
foreach (qw/systemd systemd-initrd dracut-systemd fadump/) {
|
||||
my ($dir) = glob($dracutmoduledir . "[0-9]*" . $_);
|
||||
if (-d $dir) {
|
||||
$dracutmodulelist .= " $_";
|
||||
}
|
||||
}
|
||||
|
||||
# update etc/dracut.conf
|
||||
|
Reference in New Issue
Block a user