2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Merge pull request #6493 from cxhong/pkglist

Add support to provision SLE15 diskfull/diskless compute nodes
This commit is contained in:
Mark Gurevich 2019-11-22 14:55:02 -05:00 committed by GitHub
commit 503305bc3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 182 additions and 5631 deletions

View File

@ -1 +0,0 @@
compute.sle15.pkglist

View File

@ -1 +0,0 @@
compute.sle15.tmpl

View File

@ -0,0 +1,22 @@
@base
@x11
openssl
ntp
rsync
nmap
perl-DBI
vsftpd
perl-IO-Tty
perl-Expect
perl-SNMP
unixODBC
perl-Net-DNS
perl-DBD-mysql
mariadb-client
libmysqlclient18
# The following rpms are available on the SLES SDK
# You will need to locate and make these rpms available in your zypper
# repository for service node installs and uncomment the following lines:
#MyODBC-unixODBC
#perl-DBD-Pg

View File

@ -0,0 +1,2 @@
xcat/xcat-core/xCATsn
xcat/xcat-dep/sles12/ppc64le/goconserver

View File

@ -0,0 +1,91 @@
<?xml version="1.0"?>
<!DOCTYPE profile SYSTEM "/usr/share/YaST2/include/autoinstall/profile.dtd">
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<install>
<bootloader>
<write_bootloader config:type="boolean">true</write_bootloader>
<activate config:type="boolean">true</activate>
<kernel_parameters>#XCATVAR:PERSKCMDLINE#</kernel_parameters>
<lba_support config:type="boolean">false</lba_support>
<linear config:type="boolean">false</linear>
<location>mbr</location>
</bootloader>
<general>
<clock>
<hwclock>GMT</hwclock>
<timezone>#TABLE:site:key=timezone:value#</timezone>
</clock>
<keyboard>
<keymap>english-us</keymap>
</keyboard>
<language>en_US</language>
<mode>
<confirm config:type="boolean">false</confirm>
<forceboot config:type="boolean">false</forceboot>
<interactive_boot config:type="boolean">false</interactive_boot>
<reboot config:type="boolean">true</reboot>
</mode>
<mouse>
<id>non</id>
</mouse>
<signature-handling>
<accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key>
<accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key>
<accept_unsigned_file config:type="boolean">true</accept_unsigned_file>
</signature-handling>
</general>
<partitioning config:type="list">
<!-- XCAT-PARTITION-START -->
<drive>
<device>XCATPARTITIONHOOK</device>
<initialize config:type="boolean">true</initialize>
<use>all</use>
</drive>
<!-- XCAT-PARTITION-END -->
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>
<configure>
<users config:type="list">
<user>
<username>root</username>
<user_password>#CRYPT:passwd:key=system,username=root:password#</user_password>
<encrypted config:type="boolean">true</encrypted>
<forename/>
<surname/>
</user>
</users>
<networking>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
<domain>local</domain>
<hostname>linux</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<keep_install_network config:type="boolean">true</keep_install_network>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list"/>
</routing>
</networking>
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.sles11#
</scripts>
</configure>
</profile>

View File

@ -0,0 +1,2 @@
xcat/xcat-core/xCATsn
xcat/xcat-dep/sles12/x86_64/goconserver

View File

@ -1,3 +0,0 @@
#!/bin/sh
[ "$1" = "-d" ] && echo network
exit 0

View File

@ -1,9 +0,0 @@
#!/bin/sh
echo $drivers
dracut_install wget tar cpio gzip modprobe touch echo cut wc xz
dracut_install grep ip hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
inst "$moddir/xcatroot" "/sbin/xcatroot"
inst_hook cmdline 10 "$moddir/xcat-cmdline.sh"

View File

@ -1,8 +0,0 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip modprobe wc touch echo cut
dracut_install grep ip hostname awk egrep grep dirname expr
dracut_install parted mke2fs bc mkswap swapon chmod
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
inst_hook pre-mount 5 "$moddir/xcat-premount.sh"
inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh"

View File

@ -1,2 +0,0 @@
#!/bin/bash
instmods nfs sunrpc

View File

@ -1,41 +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_install logger
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"
}
[ -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

View File

@ -1,97 +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" ]
}
#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

View File

@ -1,4 +0,0 @@
root=1
rootok=1
netroot=xcat
echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/xcatroot.sh

View File

@ -1,18 +0,0 @@
#!/bin/sh
#script to update nodelist.nodestatus during provision
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

View File

@ -1,173 +0,0 @@
#!/bin/sh
NEWROOT=/sysroot
SERVER=${SERVER%%/*}
SERVER=${SERVER%:}
RWDIR=.statelite
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`
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
}
bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//)
cat <<EOF > $NEWROOT/etc/sysconfig/network/ifcfg-$bootif
BOOTPROTO='dhcp'
STARTMODE='auto'
EOF
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/ifcfg-$ETHX ]; then
touch $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
fi
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
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network/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

View File

@ -1,341 +0,0 @@
#!/bin/sh
NEWROOT=$3
RWDIR=.statelite
XCATMASTER=$XCAT
. /lib/dracut-lib.sh
rootlimit="$(getarg rootlimit=)"
getarg nonodestatus
NODESTATUS=$?
MASTER=`echo $XCATMASTER |awk -F: '{print $1}'`
XCATIPORT="$(getarg XCATIPORT=)"
if [ $? -ne 0 ]; then
XCATIPORT="3002"
fi
xcatdebugmode="$(getarg xcatdebugmode=)"
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "running xcatroot...."
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
if [ $NODESTATUS -ne 0 ];then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
fi
if [ ! -z "$imgurl" ]; then
if [ xhttp = x${imgurl%%:*} ]; then
NFS=0
FILENAME=${imgurl##*/}
while [ ! -r "$FILENAME" ]; do
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl...."
echo Getting $imgurl...
if ! wget -nv $imgurl; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...."
rm -f $FILENAME
sleep 27
fi
done
elif [ xnfs = x${imgurl%%:*} ]; then
NFS=1
SERVER=${imgurl#nfs:}
SERVER=${SERVER#/}
SERVER=${SERVER#/}
ROOTDIR=$SERVER
SERVER=${SERVER%%/*}
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
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...."
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 xcat -p debug "Extracting root filesystem:"
echo -n "Extracting 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
[ -x $NEWROOT/etc/init.d/localdisk ] && $NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...."
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 xcat -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
if [ -r /rootimg.tar.gz ]; then
tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz
if [ $? -ne 0 ]; then
tar -zxf /rootimg.tar.gz
fi
elif [ -r /rootimg.tar.xz ]; then
tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz
if [ $? -ne 0 ]; then
tar -Jxf /rootimg.tar.xz
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.
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
echo -n "Extracting root filesystem:"
if [ -x /bin/cpio ]; then
gzip -cd /rootimg-statelite.gz |/bin/cpio -idum
else
gzip -cd /rootimg-statelite.gz |cpio -idum
fi
echo Done
# then, the statelite staffs will be processed
echo Setting up Statelite
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`
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
[ "$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.
* 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/dash
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
bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//)
cat <<EOF > $NEWROOT/etc/sysconfig/network/ifcfg-$bootif
BOOTPROTO='dhcp'
STARTMODE='auto'
EOF
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/ifcfg-$ETHX ]; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "creating $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX"
touch $NEWROOT/etc/sysconfig/network/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/ifcfg-$ETHX
echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network/ifcfg-$ETHX
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 "setting hostname..."
echo `hostname` > $NEWROOT/etc/hostname
[ "$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"' > $hookdir/initqueue/xcat.sh
# force udevsettle to break
> $hookdir/initqueue/work

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
aaa_base
coreutils
bash
dbus
wicked
device-mapper
dracut
nfs-kernel-server
keyutils
lvm2
openssl
dhcp-client
openssh
procps
psmisc
wget
sysconfig
rsyslog
vim
rsync
timezone
bc
ntp
gzip
e2fsprogs
parted
binutils
tar
open-iscsi
curl
plymouth
btrfsprogs
cryptsetup
dmraid
mdadm
multipath-tools
gpg2
which
cifs-utils
open-lldp
fcoe-utils
util-linux-systemd
plymouth-dracut
udev
kernel-default
kernel-firmware
adaptec-firmware
xz

View File

@ -1,6 +1,10 @@
aaa_base
coreutils
bash
dbus
wicked
device-mapper
dracut
nfs-kernel-server
keyutils
lvm2

View File

@ -1,7 +1,7 @@
#!/bin/sh
echo $drivers
dracut_install wget tar cpio gzip modprobe touch echo cut wc xz
dracut_install grep ifconfig hostname awk egrep grep dirname expr
dracut_install grep ifconfig ip hostname awk egrep grep dirname expr
dracut_install mount.nfs
dracut_install parted mke2fs bc mkswap swapon chmod
inst "$moddir/xcat-updateflag" "/tmp/updateflag"

View File

@ -1,7 +1,7 @@
#!/bin/sh
echo $drivers
dracut_install wget cpio gzip modprobe wc touch echo cut
dracut_install grep ifconfig hostname awk egrep grep dirname expr logger
dracut_install grep ifconfig ip hostname awk egrep grep dirname expr logger
dracut_install parted mke2fs bc mkswap swapon chmod
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
inst_hook pre-mount 5 "$moddir/xcat-premount.sh"

View File

@ -264,11 +264,17 @@ unless ($onlyinitrd) {
# To support multiple paths for osimage.pkgdir
foreach $dir (@pkgdirs) {
my $ddir = $dir;
if (-d "$dir/1") {
$dir .= "/1";
$ddir .= "/1";
}
system("zypper -R $rootimg_dir $non_interactive ar file:$dir $osver-$i");
system("zypper -R $rootimg_dir $non_interactive ar file:$ddir $osver-$i");
$i++;
if (-d "$dir/2") {
$ddir = $dir . "/2";
system("zypper -R $rootimg_dir $non_interactive ar file:$ddir $osver-$i");
$i++;
}
}
#if(-e "$rootimg_dir/etc/zypp/repos.d/$osver.repo") {

View File

@ -0,0 +1,3 @@
-perl-doc
xcat/xcat-core/xCATsn
xcat/xcat-dep/sles12/x86_64/conserver-xcat