2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 18:50:28 +00:00

Merge pull request #5621 from jjohnson42/sle15stateless

SLE15 stateless support
This commit is contained in:
cxhong
2019-11-19 12:31:24 -05:00
committed by GitHub
20 changed files with 5905 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
./boot*
./etc/bootsplash/themes/SLES/images*
./opt/sci/include*
./usr/include*
./usr/lib/locale*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/auto/Encode/CN*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/auto/Encode/JP*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/auto/Encode/TW*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/auto/Encode/KR*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/Encode/CN*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/Encode/JP*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/Encode/KR*
./usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/Encode/TW*
./usr/lib64/gcc/x86_64-suse-linux/4.3/include*
./usr/local/include*
./usr/local/man*
./usr/x86_64-suse-linux/include*
./usr/share/X11/locale/*
+./usr/share/X11/locale/en_US.UTF-8*
+./usr/share/X11/locale/C*
./usr/share/cracklib*
./usr/share/doc*
./usr/share/doc/packages/cyrus-sasl/doc*
./usr/share/gnome*
./usr/share/i18n*
./usr/share/info*
./usr/share/locale/*
+./usr/share/locale/en_US*
+./usr/share/locale/C*
./usr/share/man*
./usr/share/omf*
./usr/share/vim/site/doc*
./usr/share/vim/vim72/doc*
./var/cache/man*
./var/cache/yum*

View File

@@ -0,0 +1,45 @@
aaa_base
coreutils
bash
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
SLE_HPC-release

View File

@@ -0,0 +1,46 @@
#!/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
${profile}_${arch} / tmpfs rw 0 1
none /tmp tmpfs defaults,size=10m 0 2
none /var/tmp tmpfs defaults,size=10m 0 2
END
#-- Uncomment the line contains "cons" in /etc/inittab
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
TMP_inittab=`sed 's/\(#\)\(cons:12345.*\)$/\2/' $installroot/etc/inittab`
echo "$TMP_inittab" > $installroot/etc/inittab
#-- 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

View File

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

View File

@@ -0,0 +1,9 @@
#!/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

@@ -0,0 +1,8 @@
#!/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

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

View 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
}

View File

@@ -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

View 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

View File

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

View File

@@ -0,0 +1,18 @@
#!/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

@@ -0,0 +1,173 @@
#!/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

@@ -0,0 +1,341 @@
#!/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,70 @@
aaa_base
adaptec-firmware
apache2
apache2-prefork
bash
bind
bind-utils
binutils
bc
btrfsprogs
bzip2
cifs-utils
coreutils
cron
cryptsetup
curl
dhcp
dhcp-client
dhcp-relay
dhcp-server
dmraid
e2fsprogs
fcoe-utils
gpg2
gzip
xz
kernel-default
keyutils
lvm2
mdadm
multipath-tools
nfs-kernel-server
ntp
openssh
openssl
open-iscsi
open-lldp
pam
pam-modules
parted
perl-doc
perl-Expect
plymouth
plymouth-dracut
procps
psmisc
rpm
rsync
sysconfig
tar
timezone
udev
util-linux
util-linux-systemd
vim
vsftpd
wget
which
zypper
#for database
unixODBC
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,68 @@
#!/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:
cp $installroot/etc/fstab $installroot/etc/fstab.prev
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
${profile}_${arch} / tmpfs rw 0 1
none /tmp tmpfs defaults,size=10m 0 2
none /var/tmp tmpfs defaults,size=10m 0 2
END
cat <<END >>$installroot/etc/hosts
`getent hosts $HOSTNAME`
END
#Prevent DHCP from starting up until xcatd has had a chance to configure it:
chroot $installroot chkconfig dhcpd off
chroot $installroot chkconfig dhcrelay off
#turn on some services
chroot $installroot chkconfig dbus on
chroot $installroot chkconfig boot.localnet on
chroot $installroot chkconfig haldaemon on
chroot $installroot chkconfig network on
chroot $installroot chkconfig syslog on
chroot $installroot chkconfig apache2 on
#export /install as read-only
mkdir -p /install
echo '/install *(ro,no_root_squash,sync,fsid=13)' > $installroot/etc/exports
#uncomment out the cons line in etc/inittab
#sed -i 's/^\#\(\s\)*cons/cons/' $installroot/etc/inittab
TMP_inittab=`sed 's/\(#\)\(cons:12345.*\)$/\2/' $installroot/etc/inittab`
echo "$TMP_inittab" > $installroot/etc/inittab
#-- 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

View File

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

View File

@@ -0,0 +1,12 @@
[Unit]
Description=xcat service on compute node, the framework to run postbootscript and update node status
After=network.target rsyslog.service
[Service]
Type=oneshot
ExecStart=/opt/xcat/xcatpostinit start
ExecStop=/opt/xcat/xcatpostinit stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target