mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
[Task 6675] genimage requires dracut diretories for sles12
This commit is contained in:
parent
9195cf7faf
commit
ee61b112a2
36
xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist
Executable file
36
xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist
Executable 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/ppc64-linux-thread-multi/auto/Encode/CN*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/auto/Encode/JP*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/auto/Encode/TW*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/auto/Encode/KR*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/Encode/CN*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/Encode/JP*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/Encode/KR*
|
||||
./usr/lib/perl5/5.10.0/ppc64-linux-thread-multi/Encode/TW*
|
||||
./usr/lib64/gcc/powerpc64-suse-linux/4.3/include*
|
||||
./usr/local/include*
|
||||
./usr/local/man*
|
||||
./usr/powerpc64-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*
|
||||
|
@ -1,20 +1,34 @@
|
||||
bash
|
||||
aaa_base
|
||||
bash
|
||||
nfs-kernel-server
|
||||
openssl
|
||||
dhcp-client
|
||||
kernel-default
|
||||
openssh
|
||||
procps
|
||||
psmisc
|
||||
wget
|
||||
sysconfig
|
||||
sysconfig
|
||||
rsyslog
|
||||
vim
|
||||
rsync
|
||||
bc
|
||||
powerpc-utils
|
||||
timezone
|
||||
iputils
|
||||
lsvpd
|
||||
irqbalance
|
||||
procps
|
||||
bc
|
||||
ntp
|
||||
nfs-client
|
||||
dhcp-client
|
||||
gzip
|
||||
e2fsprogs
|
||||
parted
|
||||
binutils
|
||||
tar
|
||||
open-iscsi
|
||||
curl
|
||||
plymouth
|
||||
btrfsprogs
|
||||
cryptsetup
|
||||
dmraid
|
||||
mdadm
|
||||
multipath-tools
|
||||
gpg2
|
||||
cifs-utils
|
||||
util-linux-systemd
|
||||
|
||||
|
3
xCAT-server/share/xcat/netboot/sles/dracut_033/check
Executable file
3
xCAT-server/share/xcat/netboot/sles/dracut_033/check
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
[ "$1" = "-d" ] && echo network
|
||||
exit 0
|
9
xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot
Executable file
9
xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget cpio gzip modprobe touch echo cut wc
|
||||
dracut_install grep ifconfig 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"
|
8
xCAT-server/share/xcat/netboot/sles/dracut_033/install.statelite
Executable file
8
xCAT-server/share/xcat/netboot/sles/dracut_033/install.statelite
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget 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
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
inst_hook pre-mount 5 "$moddir/xcat-premount.sh"
|
||||
inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh"
|
2
xCAT-server/share/xcat/netboot/sles/dracut_033/installkernel
Executable file
2
xCAT-server/share/xcat/netboot/sles/dracut_033/installkernel
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc
|
@ -0,0 +1,4 @@
|
||||
root=1
|
||||
rootok=1
|
||||
netroot=xcat
|
||||
echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/xcatroot.sh
|
@ -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
|
174
xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh
Executable file
174
xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh
Executable file
@ -0,0 +1,174 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
|
||||
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/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
|
24
xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-updateflag
Executable file
24
xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-updateflag
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/awk -f
|
||||
#script to feedback the node provision status to xcatd
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if($0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
278
xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot
Executable file
278
xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot
Executable file
@ -0,0 +1,278 @@
|
||||
#!/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
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
if [ ! -z "$imgurl" ]; then
|
||||
if [ xhttp = x${imgurl%%:*} ]; then
|
||||
NFS=0
|
||||
FILENAME=${imgurl##*/}
|
||||
while [ ! -r "$FILENAME" ]; do
|
||||
echo Getting $imgurl...
|
||||
if ! wget $imgurl; then
|
||||
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.gz ]; then
|
||||
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
|
||||
echo -n "Extracting root filesystem:"
|
||||
if [ -x /bin/cpio ]; then
|
||||
gzip -cd /rootimg.gz |/bin/cpio -idum
|
||||
else
|
||||
gzip -cd /rootimg.gz |cpio -idum
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
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
|
||||
echo -n Failed to download image, panicing in 5...
|
||||
for i in 4 3 2 1 0; do
|
||||
/bin/sleep 1
|
||||
echo -n $i...
|
||||
done
|
||||
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
|
||||
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/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
|
||||
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
|
@ -246,7 +246,7 @@ unless ($onlyinitrd) {
|
||||
close($fd);
|
||||
|
||||
my $non_interactive;
|
||||
if (!$prompt) { $non_interactive="--non-interactive --no-gpg-checks"; }
|
||||
if (!$prompt) { $non_interactive="--non-interactive --no-gpg-checks --gpg-auto-import-keys"; }
|
||||
|
||||
if($osver_host == 11) {#zypper in SLES11 is different
|
||||
|
||||
@ -1676,11 +1676,15 @@ sub generic_post { # This function is meant to leave the image in a state approx
|
||||
|
||||
#modify /etc/sysconfig/clock in the image:HWCLOCK="--local", TIMEZONE=site:timezone
|
||||
if ($timezone) {
|
||||
system("sed -i '".'s!\(TIMEZONE=\).*!\1'."\"$timezone\"!"."' $rootimg_dir/etc/sysconfig/clock");
|
||||
if (-e $rootimg_dir/etc/sysconfig/clock) {
|
||||
system("sed -i '".'s!\(TIMEZONE=\).*!\1'."\"$timezone\"!"."' $rootimg_dir/etc/sysconfig/clock");
|
||||
}
|
||||
system("chroot $rootimg_dir zic -l $timezone");
|
||||
}
|
||||
|
||||
system("sed -i 's!\\(HWCLOCK=\\).*!\\1\"--localtime\"!' $rootimg_dir/etc/sysconfig/clock");
|
||||
if (-e $rootimg_dir/etc/sysconfig/clock) {
|
||||
system("sed -i 's!\\(HWCLOCK=\\).*!\\1\"--localtime\"!' $rootimg_dir/etc/sysconfig/clock");
|
||||
}
|
||||
|
||||
unlink("$rootimg_dir/dev/null");
|
||||
system("mknod $rootimg_dir/dev/null c 1 3");
|
||||
|
Loading…
x
Reference in New Issue
Block a user