From 2bad99014042d4771b337e8a1d6f88d7962f6421 Mon Sep 17 00:00:00 2001 From: Anne Nicolas Date: Mon, 15 Oct 2012 07:02:32 +0000 Subject: fix mount bind --- BCD/Media.pm | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'BCD') diff --git a/BCD/Media.pm b/BCD/Media.pm index 499efc1..333bac8 100644 --- a/BCD/Media.pm +++ b/BCD/Media.pm @@ -95,6 +95,23 @@ sub use_gendistrib { print_color("$LOG gendistrib --mediacfg $builddir/$isoconf->{iso}{mediacfg} $builddir", $color); my $cmd = "gendistrib --mediacfg $builddir/$isoconf->{iso}{mediacfg} $builddir"; system($cmd) == 0 or die "$LOG system $cmd failed: $?\n"; + if ($isoconf->{based_on} lt "2009.1" || $isoconf->{based_on} eq "mes5") { + foreach my $media (@{$isoconf->{media}{list}}) { + $media->{name} or next; + if ($destmedia eq $media->{destmedia}) { next } + $destmedia = $media->{destmedia}; + print_color("$LOG < 2009.1 or mes5 detected", $color); + print_color("$LOG move hdlists and synthesys from $builddir/media/$destmedia/media_info to $builddir/media/media_info/", $color); + system("rm -vf $builddir/media/media_info/*_$media->{name}.cz"); +# system("rm -vf $builddir/media/media_info/*_main.cz"); + system("rm -vf $builddir/media/media_info/pubkey_$media->{name}"); + system("cp -avf $builddir/media/$destmedia/media_info/hdlist.cz $builddir/media/media_info/hdlist_$media->{name}.cz"); + system("cp -avf $builddir/media/$destmedia/media_info/pubkey $builddir/media/media_info/pubkey_$media->{name}"); + system("cp -avf $builddir/media/$destmedia/media_info/synthesis.hdlist.cz $builddir/media/media_info/synthesis.hdlist_$media->{name}.cz"); + system("rm -vf $builddir/media/$destmedia/media_info/*.cz"); + system("rm -vf $builddir/media/$destmedia/media_info/MD5SUM"); + } + } } sub copy_rpm { @@ -111,7 +128,10 @@ sub create_mediacfg { print $MEDIACFG "\n"; print $MEDIACFG "[media_info]\n"; print $MEDIACFG "version=$version\n"; - print $MEDIACFG "mediacfg_version=2\n"; + if ($isoconf->{based_on} gt "2009.1" && $isoconf->{based_on} ne "mes5") { + print_color("$LOG > 2009.1 or not a mes5 product", $color); + print $MEDIACFG "mediacfg_version=2\n"; + } print $MEDIACFG "branch=$isoconf->{iso}{branch}\n"; print $MEDIACFG "arch=$arch\n"; print $MEDIACFG "minor=$isoconf->{iso}{minor}\n"; @@ -130,7 +150,17 @@ sub create_mediacfg { $media->{name} or next; if ($destmedia eq $media->{destmedia}) { next } $destmedia = $media->{destmedia}; + if ($isoconf->{based_on} =~ "mes5" || $isoconf->{based_on} lt "2009.1") { + print_color("$LOG < 2009.1 or mes5 detected", $color); + print $MEDIACFG " +[$media->{destmedia}] +hdlist=hdlist_$media->{name}.cz +pubkey=pubkey_$media->{name} +name=$isoconf->{iso}{header}{volumesetid} +desc=$isoconf->{iso}{header}{volumesetid} +\n"; +} else { print $MEDIACFG " [$media->{destmedia}] synthesis=$media->{destmedia}/media_info/synthesis.hdlist.cz @@ -138,7 +168,7 @@ hdlist=$media->{destmedia}/media_info/hdlist.cz pubkey=$media->{destmedia}/media_info/pubkey name=$media->{desc} \n"; - + } } close $MEDIACFG; } @@ -220,9 +250,9 @@ sub mini_chroot { # install all those file to be able to use urpmi.XXXXXX system("LC_ALL=C $cmd --prefer $DISTRIB,$THEME urpmi rootfiles rpm-helper mageia-release-common"); system("sudo chroot $chroot_path mkdir -p $distrib_path"); + print "BLBLBLBLBL sudo mount -o bind $repo/$based_on/$arch $chroot_path/$distrib_path\n"; system("sudo mount -o bind $repo/$based_on/$arch $chroot_path/$distrib_path"); - print $chroot_path; - system("sudo mount -o remount,ro $chroot_path/$distrib_path"); + system("sudo mount -o remount,ro,bind $chroot_path/$distrib_path"); push @to_umount, $distrib_path; print_color("$LOG Add a profile info", $color); my $INFOFILE = "$chroot_path/etc/profile.d/99info.sh"; @@ -646,13 +676,13 @@ sub parse_copy_link { foreach my $pkg (@list) { if (-f "$data/$pkg") { #print "$LOG $action $data/$pkg TO1 $builddir/media/main/$pkg\n"; - system("$action $data/$pkg $builddir/media/core/$pkg"); + system("$action $data/$pkg $builddir/media/main/$pkg"); next; } elsif (-f $data) { my $package = basename($data); chomp($package); #print "$LOG $action $data TO2 $builddir/media/main/$package\n"; - system("$action $data $builddir/media/core/$package"); + system("$action $data $builddir/media/main/$package"); next; } } @@ -810,6 +840,7 @@ sub use_genhdlist2 { sub remove_hdlist { my $destmedia; + if ($isoconf->{based_on} gt "2009.1" or $isoconf->{based_on} != "mes5") { print_color("$LOG remove hdlists*.cz from $builddir/media/media_info", $color); system("rm -vf $builddir/media/media_info/hdlist*.cz"); foreach my $media (@{$isoconf->{media}{list}}) { @@ -820,6 +851,7 @@ sub remove_hdlist { system("rm -vf $builddir/media/$destmedia/media_info/hdlist.cz"); system("cd $builddir/media/$destmedia/media_info ; md5sum *.cz > MD5SUM"); } + } } sub copy_all_pubkey { -- cgit v1.2.1