2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-26 13:10:35 +00:00

refine tag prefix xcat.deployment for sles/ubuntu provision (#5831)

* refine tag prefix xcat.deployment for sles/ubuntu provision
This commit is contained in:
Yuan Bai
2018-11-23 10:00:02 +08:00
committed by Bin Xu
parent 7977a2a1d7
commit b117be552a
7 changed files with 95 additions and 73 deletions

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
dracut_install grep ifconfig 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

@@ -1,6 +1,5 @@
#!/bin/sh
#script to update nodelist.nodestatus during provision
XCAT="$(getarg XCAT=)"
STATEMNT="$(getarg STATEMNT=)"
MASTER=`echo $XCAT |awk -F: '{print $1}'`
@@ -14,6 +13,7 @@ XCATIPORT="3002"
fi
log_label="xcat.deployment"
xcatdebugmode="$(getarg xcatdebugmode=)"
[ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER"
logger $SYSLOGHOST -t $log_label -p local4.info "=============deployment starting===================="
logger $SYSLOGHOST -t $log_label -p local4.info "Starting xcat-premount..."

View File

@@ -1,8 +1,13 @@
#!/bin/sh
log_label="xcat.deployment"
NEWROOT=/sysroot
SERVER=${SERVER%%/*}
SERVER=${SERVER%:}
RWDIR=.statelite
XCAT="$(getarg XCAT=)"
xcatdebugmode="$(getarg xcatdebugmode=)"
XCATMASTER=$XCAT
MASTER=`echo $XCATMASTER |awk -F: '{print $1}'`
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#*/}
@@ -14,7 +19,8 @@ if [ ! -z $STATEMNT ]; then #btw, uri style might have left future options other
SNAPSHOTSERVER=
fi
fi
[ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER"
logger $SYSLOGHOST -t $log_label -p local4.info "Executing xcat-prepivot to set up statelite..."
echo Setting up Statelite
mkdir -p $NEWROOT
@@ -25,15 +31,18 @@ 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... "
msg="This NFS root directory doesn't have a /$RWDIR directory for me to mount a rw filesystem. You'd better create it... "
echo "$msg"
echo ""
logger $SYSLOGHOST -t $log_label -p local4.error "$msg"
/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"
msg="$NEWROOT/etc/init.d/statelite doesn't exist. Perhaps you didn't create this image with th e -m statelite mode"
echo ""
logger $SYSLOGHOST -t $log_label -p local4.error "$msg"
/bin/sh
fi
@@ -57,15 +66,19 @@ if [ ! -z $SNAPSHOTSERVER ]; then
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:
msg="Your are dead, rpower $ME boot to play again.
Possible problems:
1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ?
2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER."
echo "$msg"
logger $SYSLOGHOST -t $log_label -p local4.error "$msg"
/bin/sh
exit
fi
RS= $(( $RANDOM % 20 ))
echo "Trying again in $RS seconds..."
msg="Trying again in $RS seconds..."
echo "$msg"
logger $SYSLOGHOST -t $log_label -p local4.info "$msg"
sleep $RS
done
@@ -76,8 +89,10 @@ if [ ! -z $SNAPSHOTSERVER ]; then
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."
msg="Your are dead, rpower $ME boot to play again.
Cannot umount $NEWROOT/$RWDIR/persistent."
echo "$msg"
logger $SYSLOGHOST -t $log_label -p local4.error "$msg"
/bin/sh
exit
fi
@@ -91,8 +106,10 @@ if [ ! -z $SNAPSHOTSERVER ]; then
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."
msg="Your are dead, rpower $ME boot to play again.
Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME."
echo $msg
logger $SYSLOGHOST -t $log_label -p local4.info "$msg"
/bin/sh
exit
fi
@@ -103,8 +120,10 @@ if [ ! -z $SNAPSHOTSERVER ]; then
fi
# TODO: handle the dhclient/resolv.conf/ntp, etc
echo "Get to enable localdisk"
logger $SYSLOGHOST -t $log_label -p local4.info "Enabling localdisk ..."
echo "Enable localdisk ..."
$NEWROOT/etc/init.d/localdisk
logger $SYSLOGHOST -t $log_label -p local4.info "Preparing mount points ..."
$NEWROOT/etc/init.d/statelite
READONLY=yes
export READONLY
@@ -175,3 +194,4 @@ fi
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh
# force udevsettle to break
> $hookdir/initqueue/work
logger $SYSLOGHOST -t $log_label -p local4.info "Exit xcat-prepivot"

View File

@@ -1,11 +1,12 @@
#!/bin/sh
log_label="xcat.deployment"
NEWROOT=$3
RWDIR=.statelite
XCATMASTER=$XCAT
. /lib/dracut-lib.sh
XCAT="$(getarg XCAT=)"
XCATMASTER=$XCAT
rootlimit="$(getarg rootlimit=)"
@@ -19,25 +20,27 @@ XCATIPORT="3002"
fi
xcatdebugmode="$(getarg xcatdebugmode=)"
[ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER"
logger $SYSLOGHOST -t $log_label -p local4.info "=============deployment starting===================="
logger $SYSLOGHOST -t $log_label -p local4.info "Executing xcatroot to prepare for netbooting (dracut_033)..."
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "running xcatroot...."
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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"
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
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 xcat -p debug "downloading $imgurl...."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "downloading $imgurl...."
echo Getting $imgurl...
if ! wget -nv $imgurl; then
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "downloading $imgurl failed,retrying...."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "downloading $imgurl failed,retrying...."
rm -f $FILENAME
sleep 27
fi
@@ -68,7 +71,7 @@ if [ -r /rootimg.sfs ]; then
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...."
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.
if [ -z $rootlimit ];then
mount -t tmpfs -o mode=755 rootfs $NEWROOT
@@ -77,7 +80,7 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
fi
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
if [ -r /rootimg.cpio.gz ]; then
if [ -x /bin/cpio ]; then
@@ -93,10 +96,10 @@ elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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...."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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
@@ -105,7 +108,7 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
fi
cd $NEWROOT
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "Extracting root filesystem:"
echo -n "Extracting root filesystem:"
if [ -r /rootimg.tar.gz ]; then
tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz
@@ -119,7 +122,7 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then
fi
fi
$NEWROOT/etc/init.d/localdisk
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "Done...."
echo Done
elif [ -r /rootimg-statelite.gz ]; then
echo Setting up RAM-root tmpfs for statelite mode.
@@ -244,18 +247,18 @@ elif [ -r /rootimg-statelite.gz ]; then
mount -n --bind /sys $NEWROOT/sys
else
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Failed to download image, panicing in 5..."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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..."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "You're dead. rpower nodename reset to play again."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "* Did you packimage with -m cpio, -m squashfs, or -m nfs?"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p 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 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.
@@ -296,7 +299,7 @@ if [ -z $STATEMNT ]; then
netif=${lf#*.}
netif=${netif%.*}
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
done
if [ ! -z "$ifname" ]; then
@@ -312,10 +315,10 @@ if [ -z $STATEMNT ]; then
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"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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
@@ -323,18 +326,18 @@ if [ -z $STATEMNT ]; then
fi
fi
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "saving $NEWROOT/etc/resolv.conf"
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -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 ..."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "disable selinux ..."
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
fi
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "setting hostname..."
[ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "setting hostname..."
echo `hostname` > $NEWROOT/etc/hostname
[ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "exiting xcatroot..."
logger $SYSLOGHOST -t $log_label -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

View File

@@ -1023,7 +1023,7 @@ sub mkinitrd {
NEWROOT="/sysroot"
SHELL="/bin/sh"
RWDIR=".statelite"
log_label="xcat.deployment"
# Define some colors
RESET="\033[0m"
@@ -1229,17 +1229,16 @@ ifconfig lo up
XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'`
if [ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]; then
PORT="514"
syslogd -R \$XCATMASTER:\$PORT
fi
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "running init script..."
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "MASTER=\$XCATMASTER XCATIPORT=\$XCATIPORT"
PORT="514"
syslogd -R \$XCATMASTER:\$PORT
MASTER=`echo \$XCATMASTER |awk -F: '{print \$1}'`
logger -t \$log_label -p info "=============deployment starting===================="
logger -t \$log_label -p info "Executing init to prepare for netbooting"
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t \$log_label -p debug "MASTER=\$XCATMASTER XCATIPORT=\$XCATIPORT"
#update nodelist.nodestatus to "netbooting"
if [ \$NODESTATUS != 'n' ]; then
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
logger -t \$log_label -p info "Sending request to \$XCATMASTER:\$XCATIPORT for changing status to netbooting..."
/tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting"
fi
@@ -1256,10 +1255,10 @@ for i in `cat /proc/cmdline`; do
MAXTRIES=5
ITER=0
while [ ! -r "\$FILENAME" ]; do
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "downloading \$VALUE..."
logger -t \$log_label -p info "Downloading rootfs image from \$VALUE..."
echo Getting \$VALUE...
if ! /usr/bin/wget \$VALUE; then
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "downloading \$VALUE failed,retrying..."
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t \$log_label -p debug "downloading \$VALUE failed,retrying..."
ST=`expr \$RANDOM % 5`
sleep \$ST
rm -f \$FILENAME
@@ -1338,6 +1337,7 @@ if [ "\$STATELITE" = "1" ]; then
# for statelite mode on top of the ramdisk
EOMS
print $inifile " if [ -r /rootimg-statelite.gz ]; then\n";
print $inifile " logger -t \$log_label -p info \"Setting up RAM-root tmpfs on downloaded rootimg.cpio.[gz/xz]...\"\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT \n";
@@ -1463,7 +1463,7 @@ if [ -r /rootimg.sfs ]; then
mount --move /rw \$NEWROOT/rw
EOMS
print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n";
print $inifile " logger -t \$log_label -p info \"Setting up RAM-root tmpfs on downloaded rootimg.cpio.[gz/xz]...\"\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
@@ -1471,7 +1471,7 @@ EOMS
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
}
print $inifile " cd \$NEWROOT\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"Extracting root filesystem:\"\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " if [ -r /rootimg.cpio.gz ]; then\n";
print $inifile " if [ -x /bin/cpio ]; then\n";
@@ -1486,10 +1486,9 @@ EOMS
print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n";
print $inifile " fi\n";
print $inifile " fi\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n";
print $inifile " echo Done\n";
print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n";
print $inifile " logger -t \$log_label -p info \"Setting up RAM-root tmpfs on downloaded rootimg.cpio.[gz/xz]...\"\n";
print $inifile " echo Setting up RAM-root tmpfs.\n";
if ($rootlimit) {
@@ -1498,27 +1497,26 @@ EOMS
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
}
print $inifile " cd \$NEWROOT\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"Extracting root filesystem:\"\n";
print $inifile " echo -n \"Extracting root filesystem:\"\n";
print $inifile " if [ -r /rootimg.tar.gz ]; then\n";
print $inifile " /bin/tar --selinux --xattrs --xattrs-include='*' -zxf /rootimg.tar.gz\n";
print $inifile " elif [ -r /rootimg.tar.xz ]; then\n";
print $inifile " /bin/tar --selinux --xattrs --xattrs-include='*' -Jxf /rootimg.tar.xz\n";
print $inifile " fi\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n";
print $inifile " echo Done\n";
print $inifile "else\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Failed to download image, panicing in 5...\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"Failed to download image, panicing in 5...\"\n";
print $inifile " echo -n Failed to download image, panicing in 5...\n";
print $inifile " for i in 4 3 2 1 0; do\n";
print $inifile " /bin/sleep 5\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"\$i...\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"\$i...\"\n";
print $inifile " echo -n \$i...\n";
print $inifile " done\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"You're dead. rpower nodename reset to play again.\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"* Did you packimage with -m cpio, -m squashfs, or -m nfs?\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && 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\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"You're dead. rpower nodename reset to play again.\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"* Did you packimage with -m cpio, -m squashfs, or -m nfs?\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop\"\n";
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -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\"\n";
print $inifile " echo\n";
print $inifile <<EOMS;
echo "You're dead. rpower nodename reset to play again.
@@ -1537,9 +1535,9 @@ EOMS
print $inifile "fi\n";
print $inifile "cd /\n";
print $inifile "cp /etc/hostname \$NEWROOT/etc/hostname\n";
print $inifile "([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"saving \$NEWROOT/etc/resolv.conf\"\n";
print $inifile "([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t \$log_label -p debug \"saving \$NEWROOT/etc/resolv.conf\"\n";
print $inifile "rm -f \$NEWROOT/etc/resolv.conf; cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n";
print $inifile "([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"exiting init script...\"\n";
print $inifile "logger -t \$log_label -p info \"Exiting init ...\"\n";
print $inifile "mount --move /dev \$NEWROOT/dev \n";
print $inifile "mount --move /proc \$NEWROOT/proc \n";
print $inifile "mount --move /sys \$NEWROOT/sys \n";
@@ -1644,7 +1642,7 @@ EOMS
}
}
# add rsync for statelite
# add extra commands for initrd
foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz", "bin/gzip", "bin/tar") {
getlibs($_);
push @filestoadd, $_;

View File

@@ -14,16 +14,16 @@
# Short-Description: xCATpost
# Description: xCAT post boot script
### END INIT INFO
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat"
fi
# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat.deployment"
fi
logger -t $log_label -p local4.info "$0: action is $1"
case $1 in
restart)

View File

@@ -6,6 +6,7 @@ After=network.target rsyslog.service YaST2-Firstboot.service
Type=oneshot
ExecStart=/opt/xcat/xcatpostinit1 start
ExecStop=/opt/xcat/xcatpostinit1 stop
StandardOutput=null
RemainAfterExit=yes
[Install]