2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-24 15:05:36 +00:00

several issues on site.httpport in otherpks and ospkgs (#5777)

* correct several issues

* refine ospkgs to support site.httpport
This commit is contained in:
yangsong
2018-11-08 17:50:14 +08:00
committed by Bin Xu
parent 01541aba74
commit f55b3f867b
3 changed files with 25 additions and 17 deletions

View File

@ -139,6 +139,13 @@ sub subvars {
}
$ENV{INSTALLDIR} = $installroot;
my $httpport;
$httpport = xCAT::TableUtils->get_site_attribute("httpport");
if (!defined($httpport)) {
$httpport = "80";
}
$ENV{HTTPPORT} = $httpport;
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@ -282,6 +289,7 @@ sub subvars {
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
}
#support multiple paths of osimage in rh/sles diskfull installation
my @pkgdirs;
if (defined($media_dir)) {
@ -295,11 +303,11 @@ sub subvars {
if ($c == 0) {
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
$source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
$source_in_pre .= "echo 'url --url http://'\$nextserver':$httpport/$pkgdir' >> /tmp/repos";
$source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#/$pkgdir\n"; #For rhels5.9
} else {
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver':$httpport/$pkgdir' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#/$pkgdir\n"; #for rhels5.9
}
my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl";
if( -f "$distrepofile"){
@ -309,13 +317,13 @@ sub subvars {
open($repofd,"<","$distrepofile");
$repo_in_post = <$repofd>;
close($repofd);
$repo_in_post =~ s#baseurl=#baseurl=http://$master/#g;
$repo_in_post =~ s#baseurl=#baseurl=http://$master:$httpport/#g;
$writerepo .= "\ncat >/etc/yum.repos.d/local-repository-$c.repo << 'EOF'\n";
$writerepo .="$repo_in_post\n";
$writerepo .="EOF\n";
}
} elsif ($platform =~ /^(sles|suse)/) {
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#:#TABLE:site:key=httpport:value#$pkgdir";
$source .= " <listentry>
<media_url>$http</media_url>
<product>SuSE-Linux-pkg$c</product>
@ -323,7 +331,7 @@ sub subvars {
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
</listentry>";
$source_in_pre .= "<listentry><media_url>http://'\$nextserver'$pkgdir</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
$source_in_pre .= "<listentry><media_url>http://'\$nextserver':$httpport$pkgdir</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
} elsif ($platform =~ /^sle15*/) {
if ( -d "$pkgdir") {
opendir(DIR,$pkgdir);
@ -339,7 +347,7 @@ sub subvars {
$product_name=$subdir;
}
if (defined($product_name) && defined($product_dir)){
$source .="<listentry><media_url>http://XCATNEXTSERVERHOOK$pkgdir</media_url><product>$product_name</product><product_dir>/$product_dir</product_dir></listentry>";
$source .="<listentry><media_url>http://XCATNEXTSERVERHOOK:$httpport$pkgdir</media_url><product>$product_name</product><product_dir>/$product_dir</product_dir></listentry>";
}
}
}
@ -392,7 +400,7 @@ sub subvars {
$inc =~ s/#UNCOMMENTOENABLESSH#/ /g;
}
my $sles_sdk_media = "http://" . $tmpl_hash->{tftpserver} . $media_dir . "/sdk1";
my $sles_sdk_media = "http://" . $tmpl_hash->{tftpserver}.':'.$httpport . $media_dir . "/sdk1";
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
@ -531,7 +539,7 @@ sub subvars {
}
}
elsif ("ubuntu" eq $platform) {
my $default_script = " wget http://`cat /tmp/xcatserver`" . $ENV{INSTALLDIR} . "/autoinst/getinstdisk; chmod u+x getinstdisk; ./getinstdisk;";
my $default_script = " wget http://`cat /tmp/xcatserver`".':'.$ENV{HTTPPORT} . $ENV{INSTALLDIR} . "/autoinst/getinstdisk; chmod u+x getinstdisk; ./getinstdisk;";
$inc =~ s/#INCLUDE_GET_INSTALL_DISK_SCRIPT#/$default_script/;
}
else {
@ -1117,7 +1125,7 @@ sub mirrorspec {
if (!$pkgdir) {
$pkgdir = $_;
} else {
my $osuurl = "http://" . $masternode . $_ . " ./";
my $osuurl = "http://" . $masternode.':'.$ENV{httpport} . $_ . " ./";
push @mirrors, $osuurl;
}
}

View File

@ -250,7 +250,7 @@ do
OSPKGDIR="$OSPKGDIR"
if [ $mounted -eq 0 ]; then
#OSPKGDIR="$OSPKGDIR"
ospkgdir="$NFSSERVER$dir"
ospkgdir="${NFSSERVER}:${HTTPPORT}$dir"
else
ospkgdir="$dir"
fi
@ -632,7 +632,7 @@ elif ( pmatch "$OSVER" "sle*" ); then
for sdk_src in $SDKDIR; do
bname=`basename $sdk_src`
if [ $mounted -eq 0 ]; then
sdk_src="http://$NFSSERVER/$sdk_src"
sdk_src="http://$NFSSERVER:$HTTPPORT/$sdk_src"
else
sdk_src="file://$sdk_src"
fi

View File

@ -290,7 +290,7 @@ fi
#when it is not set, we need to figure it out here
if [ -z "$OTHERPKGDIR" ]; then
if [ $mounted -eq 0 ]; then
OTHERPKGDIR="$NFSSERVER$INSTALLDIR/post/otherpkgs/$OSVER/$ARCH"
OTHERPKGDIR="${NFSSERVER}:${HTTPPORT}$INSTALLDIR/post/otherpkgs/$OSVER/$ARCH"
else
OTHERPKGDIR="$INSTALLDIR/post/otherpkgs/$OSVER/$ARCH"
fi
@ -300,7 +300,7 @@ if [ -z "$OTHERPKGDIR" ]; then
fi
else
if [ $mounted -eq 0 ]; then
OTHERPKGDIR=${NFSSERVER}${OTHERPKGDIR}
OTHERPKGDIR=${NFSSERVER}:${HTTPPORT}${OTHERPKGDIR}
fi
fi
@ -331,7 +331,7 @@ fi
OSPKGDIR="$OSPKGDIR"
if [ $mounted -eq 0 ]; then
#OSPKGDIR="$OSPKGDIR"
ospkgdir="$NFSSERVER$dir"
ospkgdir="${NFSSERVER}:${HTTPPORT}$dir"
else
ospkgdir="$dir"
fi
@ -523,7 +523,7 @@ if ( ! ( pmatch "$OSVER" "sles10*" ) && [ $haszypper -eq 1 ] ); then
for sdk_src in $SDKDIR; do
bname=`basename $sdk_src`
if [ $mounted -eq 0 ]; then
sdk_src="http://$NFSSERVER/$sdk_src"
sdk_src="http://${NFSSERVER}:${HTTPPORT}/$sdk_src"
else
sdk_src="file://$sdk_src"
fi