From c6bea4ae86c6843d9f32150a6cd29d24006cf105 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 30 May 2005 06:32:24 +0000 Subject: make drakx-in-chroot work --- perl-install/install2.pm | 8 +++++++- perl-install/install_any.pm | 4 ++-- perl-install/install_steps.pm | 10 ++++++++++ tools/drakx-in-chroot | 17 ++++++++++++----- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 9ee903de0..5f62b3ac1 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -294,7 +294,6 @@ sub addUser { #------------------------------------------------------------------------------ sub setupBootloader { my ($_clicked, $ent_number, $auto) = @_; - return if $::local_install; $o->{modules_conf}->write; @@ -341,6 +340,7 @@ sub start_i810fb() { #- MAIN #-###################################################################################### sub main { +#- $SIG{__DIE__} = sub { warn "DIE " . backtrace() . "\n" }; $SIG{SEGV} = sub { my $msg = "segmentation fault: seems like memory is missing as the install crashes"; log::l($msg); $o->ask_warn('', $msg); @@ -446,6 +446,12 @@ sub main { require move; move::init($o); } + if ($::local_install) { + push @auto, + 'selectLanguage', 'selectKeyboard', 'miscellaneous', + 'selectInstallClass', 'doPartitionDisks', 'formatPartitions', 'setupBootloader'; + fs::mount_usbfs(''); #- do it now so that when_load doesn't do it + } cp_f(glob('/stage1/tmp/*'), '/tmp'); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 46cfd2769..a44a98685 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -1567,7 +1567,7 @@ sub getHds { $o->{all_hds} = $all_hds; $o->{fstab} = [ fs::get::really_all_fstab($all_hds) ]; - fs::merge_info_from_mtab($o->{fstab}); + fs::merge_info_from_mtab($o->{fstab}) if !$::local_install; my @win = grep { isFat_or_NTFS($_) && maybeFormatted($_) && !$_->{is_removable} } @{$o->{fstab}}; log::l("win parts: ", join ",", map { $_->{device} } @win) if @win; @@ -1784,7 +1784,7 @@ my $clp_name = 'mdkinst.clp'; sub clp_on_disk() { "$::prefix/tmp/$clp_name" } sub move_clp_to_disk() { - return if -e clp_on_disk(); + return if -e clp_on_disk() || $::local_install; my ($loop, $current_clp) = devices::find_clp_loop($clp_name) or return; log::l("move_clp_to_disk: copying $current_clp to ", clp_on_disk()); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 2aa5e9643..7749aa851 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -201,6 +201,14 @@ sub doPartitionDisksAfter { if !$o->{isUpgrade}; $o->{fstab} = [ fs::get::fstab($o->{all_hds}) ]; + + if ($::local_install) { + my $p = fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ]); + my $part = fs::get::device2part($p->{device}, $o->{fstab}); + $part->{mntpoint} = '/'; + $part->{isMounted} = 1; + } + fs::get::root_($o->{fstab}) or die "Oops, no root partition"; if (arch() =~ /ppc/ && detect_devices::get_mac_generation() =~ /NewWorld/) { @@ -262,6 +270,8 @@ sub rebootNeeded($) { sub choosePartitionsToFormat($$) { my ($_o, $fstab) = @_; + return if $::local_install; + foreach (@$fstab) { $_->{mntpoint} = "swap" if isSwap($_); $_->{mntpoint} or next; diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot index f93385b1c..2c9a17005 100644 --- a/tools/drakx-in-chroot +++ b/tools/drakx-in-chroot @@ -12,7 +12,7 @@ my $LIVE_LOCATION_REL = 'install/stage2/live/'; my $CLP_LOCATION_REL = 'install/stage2/'; my $CLP_FILE_REL = $CLP_LOCATION_REL . 'mdkinst.clp'; -my ($repository, $dir) = @ARGV; +(my $repository, my $dir, @ARGV) = @ARGV; my $STAGE2_LOCATION = $SLASH_LOCATION . $STAGE2_LOCATION_ROOTED; my $sudo; @@ -23,10 +23,11 @@ if ($>) { if (-d $SLASH_LOCATION) { umount_all() == 0 or die "$SLASH_LOCATION is busy\n"; + sys("$sudo rm -f $SLASH_LOCATION/var/lib/rpm"); rm_rf($SLASH_LOCATION); } -mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/etc', '/var', '/proc', $STAGE2_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED, $prefix_ROOTED; +mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/dev/usb', '/etc', '/var', '/proc', $STAGE2_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED, $prefix_ROOTED; if (-d "$repository/$LIVE_LOCATION_REL") { sys("$sudo mount -o bind $repository/$LIVE_LOCATION_REL $STAGE2_LOCATION"); @@ -37,24 +38,30 @@ if (-d "$repository/$LIVE_LOCATION_REL") { } sys("$sudo mount -o bind $dir $SLASH_LOCATION$prefix_ROOTED"); +sys("$sudo mount -o bind $repository $SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); sys("$sudo mount -t proc none $SLASH_LOCATION/proc"); create_initial_symlinks(); create_initial_devices(); output("$SLASH_LOCATION/etc/hosts", "127.0.0.1 localhost\n") if ! -e "$SLASH_LOCATION/etc/hosts"; +my $Xnest_pid; if (whereis_binary('Xnest')) { my $DISPLAY = ':8'; - system("Xnest $DISPLAY -ac -geometry 800x600 &"); - $ENV{DISPLAY} = $DISPLAY; + $Xnest_pid = fork(); + if (!$Xnest_pid) { + exec 'Xnest', $DISPLAY, '-ac', '-geometry', '800x600' or die "Xnest failed\n"; + } + $ENV{DISPLAY} = 'localhost' . $DISPLAY; } if (my $pid = fork()) { waitpid $pid, 0; umount_all() == 0 or warn "umounting failed\n"; + kill 15, $Xnest_pid; } else { $ENV{HOME} = '/'; - my $cmd = '/usr/bin/install2 --local_install'; + my $cmd = join(' ', "/usr/bin/runinstall2 --local_install", @ARGV); exec "$sudo chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n"; } -- cgit v1.2.1