From 8aef3e9e81e89ada1d935c2062d4cb70006c0823 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 26 Mar 2012 19:48:07 +0000 Subject: [PATCH] Enhance mktoolscenter support multiple repositories, more obviously fail on mount error, give usage in the face of unrecognized cli arguments support mounting from an external nfs source rather than xcat git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12008 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/tools/mktoolscenter | 38 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/mktoolscenter b/xCAT-server/share/xcat/tools/mktoolscenter index ce220b009..512455734 100755 --- a/xCAT-server/share/xcat/tools/mktoolscenter +++ b/xCAT-server/share/xcat/tools/mktoolscenter @@ -133,10 +133,28 @@ sub question { # # Begin main # +my $nfsserver='${xcat_server}'; +my $nfspath='#BOMCPATH#'; +my $profilename="bomc"; -GetOptions("s"=>\$surrogate, "l=s"=>\$logfile, +unless (GetOptions("s"=>\$surrogate, "l=s"=>\$logfile, "ph=s"=>\$proxy{host}, "pp=i"=>\$proxy{port}, - "puser=s"=>\$proxy{user}, "ppw=s"=>\$proxy{pw}); + "puser=s"=>\$proxy{user}, "ppw=s"=>\$proxy{pw}, + "nfsserver=s"=>\$nfsserver,"nfspath=s"=>\$nfspath, + "profilename=s"=>\$profilename, +)) { + printf "Usage:\n"; + printf "--ph \n"; + printf "--pp \n"; + printf "--puser \n"; + printf "--ppw \n"; + printf "-l \n"; + printf "-s\n"; + printf "--nfsserver \n"; + printf "--nfspath \n"; + printf "--profilename \n"; + exit(1); +} if (@ARGV > 0) { open(IN,"<",@ARGV[0]) || die "Cannot open input file @ARGV[0]"; @@ -276,8 +294,12 @@ while ( question("Would you like to add others?","no","yesno") eq "yes") { my $srcdir = question("Where is the ibm_utl_bomc bin file?","/root/Desktop",''); my $asudir = question("Where is the ibm_utl_asu tgz file?","/root/Desktop",''); my $ppath = "$instroot/netboot/toolscenter/$ARCH"; -my $path = "$ppath/bomc"; -my $repo = "$ppath/repo"; +my $path = "$ppath"."/".$profilename; +my $reponame="repo"; +if ($profilename ne "bomc") { + $reponame=$profilename.".repo"; +} +my $repo = "$ppath/$reponame"; my $one_path = "$instroot/netboot/toolscenter/$ARCH"; my $two_path = "$instroot/netboot/bomc/$ARCH"; while ($path) { @@ -387,7 +409,13 @@ if [ "$1" != "serial-on" ]; then #if this terminal is a fake, don't use it, awkw # setup a mount point mkdir -p /bomc MNTPOINT=/bomc - mount -t nfs -o nolock ${xcat_server}:#BOMCPATH# /bomc +ENDOFSH +print $sh " if ! mount -t nfs -o nolock ${nfsserver}:${nfspath} /bomc; then\n"; +print $sh " echo \"Unable to mount nfs from ${nfsserver}:${nfspath} update aborted\"\n"; +print $sh <<'ENDOFSH'; + sleep 86400 + reboot -f + fi fi export UXSPI_BOOTABLE=/bomc