diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 74c1d4ceb..22e2763ef 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -323,6 +323,9 @@ unless ($onlyinitrd) { } } + # Refresh the zypper cache in case there is still old data out there + system("zypper -R $rootimg_dir refresh"); + #my $yumcmd = "yum -y -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir --disablerepo=* "; #$yumcmd .= "install "; #mkpath("$rootimg_dir/var/lib/yum"); diff --git a/xCAT-server/share/xcat/netboot/sles/genimage.yum b/xCAT-server/share/xcat/netboot/sles/genimage.yum index b55cbe286..f0b287a00 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage.yum +++ b/xCAT-server/share/xcat/netboot/sles/genimage.yum @@ -130,6 +130,7 @@ unless ($onlyinitrd) { close($fd); #system("zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ sa file:$srcdir"); my $yumcmd = "yum -y -c /tmp/genimage.$$.yum.conf --installroot=$installroot/netboot/$osver/$arch/$profile/rootimg/ "; + my $yumcmd_base = $yumcmd; $yumcmd .= "install "; mkpath("$installroot/netboot/$osver/$arch/$profile/rootimg/var/lib/yum"); #my $yumcmd = "zypper -R $installroot/netboot/$osver/$arch/$profile/rootimg/ install -y "; @@ -160,13 +161,14 @@ unless ($onlyinitrd) { $yumcmd =~ s/ $/\n/; my $rc = system($yumcmd); if ($rc) { - print "zypper invocation failed\n"; + print "yum invocation failed\n"; exit 1; } - # run zypper update to update any installed rpms + # run yum update to update any installed rpms # needed when running genimage again after updating software in repositories - my $yumcmd_update = "zypper -R $rootimg_dir update "; + my $yumcmd_update = $yumcmd_base . " update "; + $yumcmd_update =~ s/ $/\n/; $rc = system("$yumcmd_update"); # ignore any return code diff --git a/xCAT-server/share/xcat/netboot/suse/genimage b/xCAT-server/share/xcat/netboot/suse/genimage index 715982fa7..e546db9ed 100755 --- a/xCAT-server/share/xcat/netboot/suse/genimage +++ b/xCAT-server/share/xcat/netboot/suse/genimage @@ -289,6 +289,10 @@ unless ($onlyinitrd) { } } + + # Refresh the zypper cache in case there is still old data out there + system("zypper -R $rootimg_dir refresh"); + #my $yumcmd = "yum -y -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir --disablerepo=* "; #$yumcmd .= "install "; #mkpath("$rootimg_dir/var/lib/yum");