diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 205537957..6db188eb1 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -122,7 +122,7 @@ sub umount_chroot { print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; return 1; } - + #unmount all the mount points under rootimg directory #to avoid removing the direcoty/files on managemment node by mistake my @mntptlist; @@ -136,12 +136,12 @@ sub umount_chroot { foreach my $mntpt (@mntptlist){ system("umount -l $mntpt >/dev/null 2>&1") } - + if (majversion($osver) > 6) { #only remove the /dev in rootimg directory if it is not a mount point system("findmnt $rootimage_dir/dev/ >/dev/null 2>&1 || rm -rf $rootimage_dir/dev/*"); } - + #rpm complains "Failed to initialize NSS library" when /dev/urandom does not exist, leave /dev/urandom use_devurandom(); } @@ -375,7 +375,7 @@ unless ($onlyinitrd) { if($retcode){ print "$lock"; exit 1; - } + } my @envarlist=split(',',$envar); foreach my $entry (@envarlist){ @@ -504,7 +504,7 @@ unless ($onlyinitrd) { $repohash{$pass}{$index} = 1; $index++; } - + print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=file://$srcdir_otherpkgs_local/$_\ngpgpcheck=0\n\n"; $repohash{$pass}{$index} = 1; $index++; @@ -778,7 +778,7 @@ if ($postinstall_filename) { $updates{'postinstall'} = $postinstall_filename if ($tempfile); #export some osimage attributes as the environment variables - #to postinstall script + #to postinstall script $ENV{IMG_NAME}=$imagename if("" ne $imagename); $ENV{IMG_ARCH}=$arch if("" ne $arch); $ENV{IMG_OSVER}=$osver if("" ne $osver); @@ -789,7 +789,7 @@ if ($postinstall_filename) { $ENV{IMG_OTHERPKGLIST}=$otherpkglist if("" ne $otherpkglist); $ENV{IMG_OTHERPKGDIR}=$srcdir_otherpkgs if("" ne $srcdir_otherpkgs); $ENV{IMG_ROOTIMGDIR}=$rootimg_dir if("" ne $rootimg_dir); - + foreach my $rawpostinstall (split /,/, $postinstall_filename) { my ($postinstall,@args)=split(" ",$rawpostinstall) ; @@ -1102,8 +1102,8 @@ sub mkinitrd_dracut { chmod($perm & 07777, "$dracutmpath/installkernel"); my $dracutmodulelist = " xcat nfs base network kernel-modules syslog "; - - + + if (-d glob($dracutmoduledir . "[0-9]*systemd")) { $dracutmodulelist .= " systemd "; } @@ -1228,7 +1228,7 @@ MAGENTA="\033[35m" BROWN="\033[33m" NORMAL=\$RESET -# This function is used to mount files/directories from the .statelite directory +# This function is used to mount files/directories from the .statelite directory # over the root directory. # This function is stolen from redhat shell() { @@ -1271,10 +1271,10 @@ echo ' echo ' _________ ________________ ___ __\\_ ___ \\ / _ \\__ ___/ - \\ \\/ / \\ \\/ / /_\\ \\| | - > <\\ \\____/ | \\ | - /__/\\_ \\\\______ /\\____|__ /____| - \\/ \\/ \\/ + \\ \\/ / \\ \\/ / /_\\ \\| | + > <\\ \\____/ | \\ | + /__/\\_ \\\\______ /\\____|__ /____| + \\/ \\/ \\/ ' echo -e "\$RESET" } @@ -1384,7 +1384,7 @@ for i in `cat /proc/cmdline`; do # format: XCAT=xcatmaster:3001 XCATIPORT=\$VALUE fi - #if "nonodestatus" specified,do not update the nodestatus + #if "nonodestatus" specified,do not update the nodestatus if [ \$i == 'nonodestatus' ]; then NODESTATUS='n' fi @@ -1450,7 +1450,7 @@ for i in `cat /proc/cmdline`; do SERVER=`echo \$VALUE|awk -F/ '{print \$3}'` ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=4;i<=NF;i++) printf "/%s",\$i}'` fi - # for NFS root + # for NFS root elif [ "\$KEY" == 'NFSROOT' ]; then NFSROOT=1 VALUE=`echo \$i |awk -F= '{print \$2}'` @@ -1545,7 +1545,7 @@ EOMS fi fi - # now we need to mount the rest of the system. + # now we need to mount the rest of the system. if [ ! -e "\$NEWROOT/\$RWDIR" ]; then echo "" echo -e "\${RED}Hmmm... this NFS root directories doesn't have a /\$RWDIR directory for me to mount a rw filesystem. You'd better to create it... \${NORMAL}" @@ -1760,24 +1760,24 @@ EOMS print $inifile < /tmp/ncarg - nc \$1 \$2 -w 60 -e /tmp/updateflag -else - retrytimes=0 - cmd="" - while [ "\$cmd" != "done" ]; do - retrytimes=`expr \$retrytimes + 1` - if [ \$retrytimes -eq 60 ]; then - break; - fi - read -t 60 cmd - if [ "\$cmd" == "ready" ]; then - head -n 1 /tmp/ncarg - rm -rf /tmp/ncarg - fi - done - +if [ \$# -eq 3 ]; then + echo \$3 > /tmp/ncarg + nc \$1 \$2 -w 60 -e /tmp/updateflag +else + retrytimes=0 + cmd="" + while [ "\$cmd" != "done" ]; do + retrytimes=`expr \$retrytimes + 1` + if [ \$retrytimes -eq 60 ]; then + break; + fi + read -t 60 cmd + if [ "\$cmd" == "ready" ]; then + head -n 1 /tmp/ncarg + rm -rf /tmp/ncarg + fi + done + fi EOMS close($inifile); @@ -2046,7 +2046,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi chmod(0755, "$rootimg_dir/etc/init.d/gettyset"); system("cd $rootimg_dir/etc/rc3.d; ln -sf ../init.d/gettyset S60gettyset"); } - + if(-e "$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service"){ unlink("$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service"); } @@ -2056,7 +2056,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi if (!-d "$rootimg_dir/opt/xcat/") { mkdir "$rootimg_dir/opt/xcat/"; - } + } if(-e "$rootimg_dir/usr/lib/systemd/"){ #if systemd is the service management framework for the diskless image @@ -2400,9 +2400,9 @@ KERNELVER=$kernelver case "\$1" in "-m") if [ -z "\$ARCH" ]; then - ARCH=\"\$(dpkg --print-architecture 2>/dev/null || rpm -q kernel-\$(\"\$0\" -r) --qf '%{arch}' 2>/dev/null)\" + ARCH=\"\$(dpkg --print-architecture 2>/dev/null || rpm -q kernel-\$(\"\$0\" -r) --qf '%{arch}' 2>/dev/null)\" fi - case "\$ARCH" in + case "\$ARCH" in "amd64") ARCH="x86_64" ;; "ppc64el") ARCH="ppc64le" ;; esac