mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-13 01:40:26 +00:00
Merge pull request #4275 from immarvin/onissue
Support http repos for otherpkgs #4042
This commit is contained in:
@ -80,7 +80,7 @@ linuximage Attributes:
|
||||
|
||||
\ **otherpkgdir**\
|
||||
|
||||
The base directory where the non-distro packages are stored. Only 1 local directory supported at present.
|
||||
The base directory and urls of internet repos from which the non-distro packages are retrived. Only 1 local directory is supported at present. The entries should be delimited with comma ",". Currently, the internet repos are only supported on Ubuntu and Redhat.
|
||||
|
||||
|
||||
|
||||
|
@ -803,7 +803,7 @@ passed as argument rather than by table value',
|
||||
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
|
||||
pkgdir => 'The name of the directory where the distro packages are stored. It could be set to multiple paths. The multiple paths must be separated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. For ubuntu, multiple mirrors can be specified in the pkgdir attribute, the mirrors must be prefixed by the protocol(http/ssh) and delimited with "," between each other.',
|
||||
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set to multiple paths. The multiple paths must be separated by ",".',
|
||||
otherpkgdir => 'The base directory where the non-distro packages are stored. Only 1 local directory supported at present.',
|
||||
otherpkgdir => 'The base directory and urls of internet repos from which the non-distro packages are retrived. Only 1 local directory is supported at present. The entries should be delimited with comma ",". Currently, the internet repos are only supported on Ubuntu and Redhat.',
|
||||
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
|
||||
postinstall => 'Supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts:
|
||||
|
||||
|
@ -455,7 +455,30 @@ unless ($onlyinitrd) {
|
||||
}
|
||||
my %extrapkgnames;
|
||||
my %repohash;
|
||||
|
||||
|
||||
|
||||
if (keys(%extra_hash) > 0) {
|
||||
my @otherpkgdir_url;
|
||||
my @otherpkgdir_local;
|
||||
foreach my $tmpdir (split ',', $srcdir_otherpkgs){
|
||||
if($tmpdir =~ /^http:.*/){
|
||||
push @otherpkgdir_url, $tmpdir;
|
||||
}else{
|
||||
push @otherpkgdir_local,$tmpdir;
|
||||
}
|
||||
}
|
||||
|
||||
if(scalar @otherpkgdir_local >1){
|
||||
print "genimage: at most only 1 local dir in otherpkgdir is supported.\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $srcdir_otherpkgs_local;
|
||||
if(scalar @otherpkgdir_local == 1){
|
||||
$srcdir_otherpkgs_local=$otherpkgdir_local[0];
|
||||
}
|
||||
|
||||
open($yumconfig, ">>", "/tmp/genimage.$$.yum.conf");
|
||||
my $index = 1;
|
||||
foreach $pass (sort { $a <=> $b } (keys(%extra_hash))) {
|
||||
@ -468,7 +491,13 @@ unless ($onlyinitrd) {
|
||||
}
|
||||
|
||||
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next; }
|
||||
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=file://$srcdir_otherpkgs/$_\ngpgpcheck=0\n\n";
|
||||
foreach(@otherpkgdir_url){
|
||||
print $yumconfig "[otherpkgs$index]\nname=otherpkgs$index\nbaseurl=$_\ngpgpcheck=0\n\n";
|
||||
$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++;
|
||||
my $pa = $extra_hash{$pass}{$_};
|
||||
@ -488,10 +517,6 @@ unless ($onlyinitrd) {
|
||||
$yumcmd_base .= "--enablerepo=$osver-$arch-$_ ";
|
||||
}
|
||||
|
||||
# for (1..$index) {
|
||||
# $yumcmd .= "--enablerepo=otherpkgs$_ ";
|
||||
# }
|
||||
|
||||
# Hack uname when deal otherpkgs
|
||||
use_hackuname($arch, $kernelver);
|
||||
use_devnull();
|
||||
|
@ -775,6 +775,39 @@ EOF`
|
||||
fi
|
||||
done
|
||||
|
||||
#add repo for url repos in otherpkgdir
|
||||
if [ -n "OTHERPKGDIR_INTERNET" ];then
|
||||
OIFS=$IFS
|
||||
IFS=','
|
||||
OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET)
|
||||
|
||||
index=$(array_get_size repo_path)
|
||||
for url in ${OTHERPKGDIRLIST_INTERNET[@]}
|
||||
do
|
||||
if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then
|
||||
REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
|
||||
echo "[xcat-otherpkgs$index]" > $REPOFILE
|
||||
echo "name=xcat-otherpkgs$index" >> $REPOFILE
|
||||
echo "baseurl=$url" >> $REPOFILE
|
||||
echo "enabled=1" >> $REPOFILE
|
||||
echo "gpgcheck=0" >> $REPOFILE
|
||||
index=$[index+1]
|
||||
fi
|
||||
done
|
||||
|
||||
IFS=$OIFS
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
yum clean all
|
||||
fi
|
||||
if [ $haszypper -eq 1 ]; then
|
||||
result=`zypper --non-interactive refresh 2>&1`
|
||||
if [ $VERBOSE ]; then
|
||||
echo "otherpkgs: zypper --non-interactive refresh"
|
||||
echo " $result"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#now update all the existing rpms
|
||||
if [ $hasyum -eq 1 ]; then
|
||||
if [ $VERBOSE ]; then
|
||||
|
Reference in New Issue
Block a user