From 3ec9780b6ece9ce164cf362ca226ba43c6457b11 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 27 Oct 2014 05:59:56 -0400 Subject: [PATCH] fix 4322,genimage failed with pperte KIT componentwhich has environment variable --- .../share/xcat/netboot/ubuntu/genimage | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 12101fbd8..875233929 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -241,7 +241,14 @@ unless ($onlyinitrd) { my @line=split(" ",`ls -lh $installroot/$osver/$arch/dists/ | grep dr`); my $dist = $line[@line-1]; - my $aptgetcmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-get $non_interactive "; +# my $aptgetcmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-get $non_interactive "; + + # If there is env in otherpkg list + # apt-get update and apt-get install should be added env param + my $aptgetcmd = "chroot $rootimg_dir apt-get update"; + my $aptgetcmdby="chroot $rootimg_dir apt-get $non_interactive "; + + my $aptcachecmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-cache $non_interactive "; my $aptcmd1 = "debootstrap"; #my $aptcmd2 = "--arch $uarch $dist $rootimg_dir file://$installroot/$osver/$arch/"; @@ -408,9 +415,21 @@ unless ($onlyinitrd) { # install extra packages my $aptgetcmd_base = $aptgetcmd; + + #env param need to be added before each chroot + my $aptdevby=$aptgetcmd; + + # to prevent "The following packages cannot be authenticated" error, # invoke apt-get with "--allow-unauthenticated" option - $aptgetcmd .= " install --allow-unauthenticated "; + #example:If there is env IBM_PPE_RTE_LICENSE_ACCEPT , it should be in front of chroot + #IBM_PPE_RTE_LICENSE_ACCEPT=yes chroot /install/netboot/ubuntu14.04/ppc64el/compute/rootimg apt-get update&& IBM_PPE_RTE_LICENSE_ACCEPT=yes chroot /install/netboot/ubuntu14.04/ppc64el/compute/rootimg apt-get -y install --allow-unauthenticated pperte-license + $aptdevby .="&& ".$envlist." "; + $aptdevby .=$aptgetcmdby; + $aptdevby .=" install --allow-unauthenticated "; + $aptgetcmd=$aptdevby; + $aptgetcmd_base = $aptgetcmd; + # append extra pkg names to yum command if ($extrapkgnames{$pass}) { $aptgetcmd .= " $extrapkgnames{$pass} ";