aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Media.pm
diff options
context:
space:
mode:
Diffstat (limited to 'BCD/Media.pm')
-rw-r--r--BCD/Media.pm47
1 files changed, 30 insertions, 17 deletions
diff --git a/BCD/Media.pm b/BCD/Media.pm
index ed7b7c1..9f603b4 100644
--- a/BCD/Media.pm
+++ b/BCD/Media.pm
@@ -108,7 +108,7 @@ sub use_gendistrib {
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/*_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}");
@@ -248,15 +248,31 @@ sub mini_chroot {
# it is usefull to use a mini chroot for add remove media, we have to keep the list of installed packages to copy them on ISO
print_color("$LOG create a mini chroot to run urpmi", $color);
# store all file needed to be installed on the system
- my $cmd = "LC_ALL=C sudo urpmi --quiet --no-suggests --auto --no-verify-rpm --use-distrib $repo/$based_on/$arch --urpmi-root $chroot_path";
+ my $cmd = "LC_ALL=C sudo urpmi --quiet --no-suggests --auto --no-verify-rpm --use-distrib $repo/$based_on/$arch --urpmi-root $chroot_path --media '$isoconf->{chroot_media}' --excludemedia '$isoconf->{chroot_media_exclude}'";
# sudo urpmi --no-verify-rpm --auto --urpmi-root /tmp/mk --use-distrib /mnt/BIG/dis/2009.0/i586/ basesystem-minimal urpmi --test
#
- system("LC_ALL=C sudo urpmi --test --no-suggests --auto --no-verify-rpm --use-distrib $repo/$based_on/$arch --urpmi-root /tmp/$isoconf->{nameid}-$version-$isoconf->{arch} --media '$isoconf->{chroot_media}' --excludemedia '$isoconf->{chroot_media_exclude}' urpmi basesystem-minimal bash basesystem > $chroot_path/$isoconf->{tocopy_file}_TODO_chroot");
+#J print_color("---DEBUG INSTALLABLE_START $LOG test if the chroot is installable\n LC_ALL=C sudo urpmi --test --no-suggests --auto --no-verify-rpm --use-distrib $repo/$based_on/$arch --urpmi-root /tmp/$isoconf->{nameid}-$version-$isoconf->{arch} --media 'Main,Main Updates' --excludemedia 'Main Testing,Main Backports' urpmi basesystem-minimal bash basesystem > $chroot_path/$isoconf->{tocopy_file}_TODO_chroot", $color);
+ system("LC_ALL=C sudo urpmi --test --no-suggests --auto --no-verify-rpm --use-distrib $repo/$based_on/$arch --urpmi-root /tmp/$isoconf->{nameid}-$version-$isoconf->{arch} --media 'Main,Main Updates' --excludemedia 'Main Testing,Main Backports' urpmi basesystem-minimal bash basesystem > $chroot_path/$isoconf->{tocopy_file}_TODO_chroot");
+# print_color("---DEBUG INSTALLABLE_STOP the TEST");
# install all those file to be able to use urpmi.XXXXXX
- system("LC_ALL=C $cmd --prefer $DISTRIB,$THEME urpmi bash");
+# print_color("---DEBUG INSTALL_CHROOT_START now create the chroot:\n $cmd --prefer $DISTRIB,$THEME urpmi bash", $color);
+ system("$cmd --prefer $DISTRIB,$THEME urpmi bash");
+# print_color("---DEBUG INSTALL_CHROOT_STOP", $color);
+ if (! -e "$chroot_path/bin/mkdir") {
+ print_color("$LOG ERROR, mkdir is not available in $chroot_path", $color);
+ exit 1;
+ }
system("sudo chroot $chroot_path mkdir -p $distrib_path");
system("sudo mount -o bind $repo/$based_on/$arch $chroot_path/$distrib_path -o ro");
push @to_umount, $distrib_path;
+ print_color("$LOG Add a profile info", $color);
+ my $INFOFILE = "$chroot_path/etc/profile.d/99info.sh";
+ open my $INFO, ">$INFOFILE";
+ print $INFO "#!/bin/sh\n";
+ print $INFO "DIS=`cat /etc/product.id`\n";
+ print $INFO "export PS1=\"\\n\$DIS\\n [ CHROOT BY BCD \\u@\\h \\W]\$ \"";
+ close $INFO;
+ system("chmod 755 $INFOFILE");
system("sudo chroot $chroot_path urpmi.removemedia -a");
foreach my $media (@{$isoconf->{media}{list}}) {
$media->{name} or next;
@@ -272,9 +288,6 @@ sub mini_chroot {
system("sudo chroot $chroot_path urpmi.addmedia --probe-synthesis '$media->{name} Testing' $distrib_path/media/$media->{mediadir}/testing");
}
}
-# } else {
-# system("sudo chroot $chroot_path urpmi.addmedia --distrib $distrib_path --no-md5sum");
-# }
}
sub add_media {
@@ -418,7 +431,7 @@ sub create_list {
if ($media->{updates} eq "yes") {
$extra_media = "--media \"$isoconf->{media}{first_media} $isoconf->{media}{update_prefix},$extra2,$media_supp,$media->{name},$media->{name} $isoconf->{media}{update_prefix}\"";
} else {
- $extra_media = "--media \"$isoconf->{media}{first_media},$extra2,$media_supp,$media->{name}\"";
+ $extra_media = "--media \"$isoconf->{media}{first_media},$extra2,$media_supp,$media->{name}\"";
}
}
@@ -453,15 +466,15 @@ sub create_list {
###
# do the job with update, find missing package from list
# only if the media as udpate option enable
-## if ($media->{updates} eq "yes") {
-## my $cmd_find_missing_update = "LC_ALL=C sudo chroot $chroot_path urpmq --update --prefer $DISTRIB,$THEME $urpmq_options $urpmq_extra_opt $tested_wanted $tested_exclude 2> $urpmq_error_update";
-## print_color("$LOG first attempt to run urpmq --update on media $media->{name} (to find all packages not availables in update)", $color);
-## system($cmd_find_missing_update);
-## # urpmq error found, so we have to remove some entry in the list of wanted packages
-## my $final_list_update = remove_notpresent($urpmq_error_update, $wanted);
-## my $cmd_do_it_update = "LC_ALL=C sudo -P chroot $chroot_path urpmq --update -a --prefer $DISTRIB,$THEME $urpmq_options $urpmq_extra_opt $tested_exclude";
-## do_fork($final_list_update, "$list_filename" . "_update", $list_update, $cmd_do_it_update);
-## }
+ if ($media->{updates} eq "yes") {
+ my $cmd_find_missing_update = "LC_ALL=C sudo chroot $chroot_path urpmq --update --prefer $DISTRIB,$THEME $urpmq_options $urpmq_extra_opt $tested_wanted $tested_exclude 2> $urpmq_error_update";
+ print_color("$LOG first attempt to run urpmq --update on media $media->{name} (to find all packages not availables in update)", $color);
+ system($cmd_find_missing_update);
+ # urpmq error found, so we have to remove some entry in the list of wanted packages
+ my $final_list_update = remove_notpresent($urpmq_error_update, $wanted);
+ my $cmd_do_it_update = "LC_ALL=C sudo -P chroot $chroot_path urpmq --update -a --prefer $DISTRIB,$THEME $urpmq_options $urpmq_extra_opt $tested_exclude";
+ do_fork($final_list_update, "$list_filename" . "_update", $list_update, $cmd_do_it_update);
+ }
###
# select rpm from all media, find missing from list