From 112f5aeebd6ea735dfa0fa1c683ba4ee781c7f48 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 10 Nov 2011 14:26:08 +0000 Subject: [PATCH] ftp dependency removal initial code drop git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10987 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/updatenode.pm | 20 +++++++++---------- .../share/xcat/install/scripts/post.rh | 9 +++++++-- .../share/xcat/install/scripts/post.sles | 3 ++- .../share/xcat/install/scripts/post.sles11 | 3 ++- xCAT/postscripts/ospkgs | 8 ++++---- xCAT/postscripts/otherpkgs | 8 ++++---- xCAT/postscripts/xcatdsklspost | 6 +++++- 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index e10b2bb0e..a4a986007 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -2462,10 +2462,10 @@ sub updateOS { # Get install directory my $installDIR = xCAT::Utils->getInstallDir(); - # Get FTP server - my $ftp = xCAT::Utils->my_ip_facing($node); - if ( !$ftp ) { - push @{$rsp->{data}}, "$node: (Error) Missing FTP server"; + # Get HTTP server + my $http = xCAT::Utils->my_ip_facing($node); + if ( !$htp ) { + push @{$rsp->{data}}, "$node: (Error) Missing HTTP server"; xCAT::MsgUtils->message("I", $rsp, $callback); return; } @@ -2516,8 +2516,8 @@ sub updateOS { my $path; my $out; if ( "$installOS$version" =~ m/sles10/i ) { - # SUSE repository path - ftp://10.1.100.1/sles10.3/s390x/1/ - $path = "ftp://$ftp/$os/$arch/1/"; + # SUSE repository path - http://10.1.100.1/install/sles10.3/s390x/1/ + $path = "http://$http$installDIR/$os/$arch/1/"; if (!(-e "$installDIR/$os/$arch/1/")) { push @{$rsp->{data}}, "$node: (Error) Missing install directory $installDIR/$os/$arch/1/"; xCAT::MsgUtils->message("I", $rsp, $callback); @@ -2546,8 +2546,8 @@ sub updateOS { } elsif ( "$installOS$version" =~ m/sles11/i ) { - # SUSE repository path - ftp://10.1.100.1/sles10.3/s390x/1/ - $path = "ftp://$ftp/$os/$arch/1/"; + # SUSE repository path - http://10.1.100.1/install/sles10.3/s390x/1/ + $path = "http://$http$installDIR/$os/$arch/1/"; if (!(-e "$installDIR/$os/$arch/1/")) { push @{$rsp->{data}}, "$node: (Error) Missing install directory $installDIR/$os/$arch/1/"; xCAT::MsgUtils->message("I", $rsp, $callback); @@ -2571,8 +2571,8 @@ sub updateOS { } elsif ( "$installOS$version" =~ m/rh/i ) { - # Red Hat repository path - ftp://10.0.0.1/rhel5.4/s390x/Server/ - $path = "ftp://$ftp/$os/$arch/Server/"; + # Red Hat repository path - http://10.0.0.1/install/rhel5.4/s390x/Server/ + $path = "http://$http$installDIR/$os/$arch/Server/"; if (!(-e "$installDIR/$os/$arch/Server/")) { push @{$rsp->{data}}, "$node: (Error) Missing install directory $installDIR/$os/$arch/Server/"; xCAT::MsgUtils->message("I", $rsp, $callback); diff --git a/xCAT-server/share/xcat/install/scripts/post.rh b/xCAT-server/share/xcat/install/scripts/post.rh index fbf8a2214..ecea8c013 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh +++ b/xCAT-server/share/xcat/install/scripts/post.rh @@ -39,6 +39,10 @@ hostname $HOSTNAME export MASTER_IP="#XCATVAR:XCATMASTER#" export MASTER_IPS="#XCATVAR:XCATMASTER#" export MASTER="#XCATVAR:XCATMASTER#" +export INSTALLDIR=#TABLE:site:key=installdir:value# +if [ -z "$INSTALLDIR" ]; then + INSTALLDIR="/install" +fi cd /tmp RAND=$(perl -e 'print int(rand(50)). "\n"') sleep $RAND @@ -47,8 +51,8 @@ do GOTIT=0 for i in $MASTER_IPS do - wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts - #wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz + #wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost if [ "$?" = "0" ] then if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit @@ -97,6 +101,7 @@ do RAND=$(perl -e 'print int(rand(5)). "\n"') sleep $RAND done +echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo cd /xcatpost #gunzip xcatpost.tar.gz #tar -xvf xcatpost.tar diff --git a/xCAT-server/share/xcat/install/scripts/post.sles b/xCAT-server/share/xcat/install/scripts/post.sles index 9dd3a4ceb..fda3b521f 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles +++ b/xCAT-server/share/xcat/install/scripts/post.sles @@ -82,7 +82,8 @@ do for i in $MASTER_IPS do #mount -r $i:/install/postscripts /xcatpost - wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + #wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost if [ "$?" = "0" ] then if [ ! -x /usr/bin/openssl ]; then #Stop if no openssl to help the next bit diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11 b/xCAT-server/share/xcat/install/scripts/post.sles11 index bb13e4bb9..c1e22aaa1 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11 +++ b/xCAT-server/share/xcat/install/scripts/post.sles11 @@ -64,7 +64,8 @@ do for i in $MASTER_IPS do #mount -r $i:/install/postscripts /xcatpost - wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + #wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost if [ "$?" = "0" ] then if [ -x /usr/bin/openssl ]; then diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index 0b3fef25d..4a7f2f806 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -71,7 +71,7 @@ if [ $? -eq 0 ]; then fi if [ -z "$OSPKGDIR" ]; then - OSPKGDIR="$NFSSERVER/$OSVER/$ARCH" + OSPKGDIR="$NFSSERVER$INSTALLDIR/$OSVER/$ARCH" if ( pmatch "$OSVER" "sles*" ); then OSPKGDIR="$OSPKGDIR/1" elif ( pmatch "$OSVER" "rhel*" ); then @@ -162,7 +162,7 @@ if ( pmatch "$OSVER" "sles10*" ); then #add new repo if [ $mounted -eq 0 ]; then - path="ftp://$OSPKGDIR" + path="http://$OSPKGDIR" else path="dir://$OSPKGDIR" fi @@ -263,7 +263,7 @@ elif ( pmatch "$OSVER" "sles11*" ); then fi if [ $mounted -eq 0 ]; then - path="ftp://$OSPKGDIR" + path="http://$OSPKGDIR" else path="file://$OSPKGDIR" fi @@ -404,7 +404,7 @@ else echo "[$OSVER]" > $REPOFILE echo "name=$OSVER" >> $REPOFILE if [ $mounted -eq 0 ]; then - echo "baseurl=ftp://$OSPKGDIR" >> $REPOFILE + echo "baseurl=http://$OSPKGDIR" >> $REPOFILE else echo "baseurl=file://$OSPKGDIR" >> $REPOFILE fi diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 7d551bebd..bb0afce52 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -229,7 +229,7 @@ if [ $? -eq 0 ]; then fi if [ -z "$OTHERPKGDIR" ]; then - OTHERPKGDIR="$NFSSERVER/post/otherpkgs/$OSVER/$ARCH" + OTHERPKGDIR="$NFSSERVER$INSTALLDIR/post/otherpkgs/$OSVER/$ARCH" fi if [ $mounted -eq 0 ]; then @@ -392,7 +392,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do echo "[xcat-otherpkgs$index]" > $REPOFILE echo "name=xcat-otherpkgs$index" >> $REPOFILE if [ $mounted -eq 0 ]; then - echo "baseurl=ftp://$whole_path" >> $REPOFILE + echo "baseurl=http://$whole_path" >> $REPOFILE else echo "baseurl=file://$whole_path" >> $REPOFILE fi @@ -402,7 +402,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do REPOFILE="$repo_base/xCAT-otherpkgs$index.list" if [ $mounted -eq 0 ]; then - type=ftp + type=http else type=file fi @@ -579,7 +579,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do for x in `echo "$plain_pkgs" | tr " " "\n"` do - wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$OTHERPKGDIR/$x 2> /tmp/wget.log + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -nH --cut-dirs=2 -t 0 -T 60 --reject "index.html*" --no-parent http://$OTHERPKGDIR/$x 2> /tmp/wget.log done mv $dir_no_ftproot/* /xcatpost/$dir_no_ftproot; diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 8c50c3e08..6e436ff00 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -31,11 +31,15 @@ download_postscripts() return 1; fi + INSTALLDIR=`grep 'INSTALLDIR' /opt/xcat/xcatinfo |cut -d= -f2` + if [ -z "$INSTALLDIR" ]; then + INSTALLDIR="/install" + fi max_retries=5 retry=0 rc=1 while [ 0 -eq 0 ]; do - wget -l inf -nH -N -r --waitretry=10 --random-wait -T 60 ftp://$server/postscripts -P /xcatpost --cut-dirs=1 2> /tmp/wget.log + wget -l inf -nH -N -r --waitretry=10 --random-wait -T 60 -nH --cut-dirs=2 --reject "index.html*" --no-parent http://$server$INSTALLDIR/postscripts/ -P /xcatpost 2> /tmp/wget.log rc=$? if [ $rc -eq 0 ]; then