From 328ce33d9b48588abd507591d403ffcdf9612a93 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 24 Aug 2000 15:57:23 +0000 Subject: *** empty log message *** --- perl-install/ChangeLog | 16 +++++++++++++ perl-install/Makefile | 1 + perl-install/Makefile.config | 2 +- perl-install/Xconfigurator.pm | 6 ++--- perl-install/commands.pm | 2 +- perl-install/install2.pm | 47 ++++++++++++++++++++++++++++----------- perl-install/install_steps.pm | 4 ++-- perl-install/install_steps_gtk.pm | 7 +++++- perl-install/keyboard.pm | 2 +- perl-install/lang.pm | 6 ++--- perl-install/live_install | 28 +++++++++++++++++++++++ perl-install/live_install2 | 12 ++++++++++ perl-install/modules.pm | 6 +++-- perl-install/pkgs.pm | 15 ++++++++----- perl-install/share/list | 2 +- 15 files changed, 122 insertions(+), 34 deletions(-) create mode 100755 perl-install/live_install create mode 100755 perl-install/live_install2 (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index b68964555..00b72803c 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,19 @@ +2000-08-24 François Pons + + * ../update_kernel*: changed reference from extract_archive to + packadrake. + * Makefile*: added live_install and live_install2. + * Xconfigurator.pm: updated Mach64 acceleration to only 3D Rage + Pro AGP card type, commented SiS and S3ViRGE support by GLX. + * commands.pm, keyboard.pm, lang.pm, pkgs.pm, list, tools/*: + updated to use packdrake now. + * install2.pm, install_steps.pm, install_steps_gtk, Makefile*: + manage live upgrade. + * modules.pm: use standard modprobe command for load in live + upgrade. + * netconnect.pm: added minimal modification for being compilable. + * rescue/list: added packdrake and sfdisk. + 2000-08-22 dam's * drakfuck (netconnect):finished isdn PCI/ISA card implemetation diff --git a/perl-install/Makefile b/perl-install/Makefile index 8b56ad717..98214ccdd 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -52,6 +52,7 @@ install_pms: $(DIRS) chmod a+x $(DESTREP4PMS)/commands chmod a+x $(DESTREP4PMS)/standalone/* chmod a+x $(DESTREP4PMS)/g_auto_install + chmod a+x $(DESTREP4PMS)/live_install* get_needed_files: $(DIRS) # export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2 < /dev/null diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index f2166b679..1e1e4e473 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -4,7 +4,7 @@ ARCH := $(patsubst sparc%,sparc,$(ARCH)) VERSION = 2.2.10-BOOT SUDO = sudo SO_FILES = c/blib/arch/auto/c/c.so -PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm pci_probing/*.pm sbus_probing/*.pm commands install2 g_auto_install +PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm pci_probing/*.pm sbus_probing/*.pm commands install2 g_auto_install live_install live_install2 STANDALONEPMS= diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices draksec drakboot adduserdrake rpmdrake drakgw PMS += $(STANDALONEPMS:%=standalone/%) REP4PMS = /usr/bin/perl-install diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index e40788bce..917035a11 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -183,10 +183,10 @@ sub cardConfiguration(;$$$) { #- 3D acceleration configuration for XFree 3.3 using Utah-GLX. $card->{Utah_glx} = ($card->{identifier} =~ /MGA G[24]00/ || - $card->{type} =~ /ATI Mach64/ || + $card->{identifier} =~ /3D Rage Pro AGP/ || #- by default only such card are supported, with AGP ? $card->{type} =~ /RIVA TNT/ || - $card->{type} =~ /SiS / || - $card->{type} =~ /S3 ViRGE/ || + #- $card->{type} =~ /SiS / || #- EXPERIMENTAL + #- $card->{type} =~ /S3 ViRGE/ || #- EXPERIMENTAL $card->{type} =~ /Intel 810/); #- 3D acceleration configuration for XFree 4.0 using DRI. $card->{DRI_glx} = ($card->{type} =~ /Voodoo3 / || $card->{type} =~ /Voodoo Banshee / || diff --git a/perl-install/commands.pm b/perl-install/commands.pm index dd8393e12..1cfe5dfea 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -425,7 +425,7 @@ sub insmod { $f = "/tmp/$_.o"; my $cz = "/lib/modules" . (arch() eq 'sparc64' && "64") . ".cz"; -e $cz or $cz .= "2"; if (-e $cz) { - run_program::run("extract_archive $cz /tmp $_.o"); + run_program::run("packdrake -x $cz /tmp $_.o"); } elsif (-e "/lib/modules.cpio.bz2") { run_program::run("cd /tmp ; bzip2 -cd /lib/modules.cpio.bz2 | cpio -i $_.o"); } else { diff --git a/perl-install/install2.pm b/perl-install/install2.pm index dff89ba0f..d9869853e 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -230,6 +230,7 @@ $o = $::o = { #------------------------------------------------------------------------------ sub selectLanguage { + $::live and return; $o->selectLanguage($_[1] == 1); addToBeDone { @@ -240,6 +241,7 @@ sub selectLanguage { #------------------------------------------------------------------------------ sub selectMouse { + $::live and return; my ($clicked) = $_[0]; add2hash($o->{mouse} ||= {}, { mouse::read($o->{prefix}) }) if $o->{isUpgrade} && !$clicked; @@ -250,6 +252,7 @@ sub selectMouse { #------------------------------------------------------------------------------ sub setupSCSI { + $::live and return; my ($clicked) = $_[0]; $o->{autoSCSI} ||= $::beginner; @@ -258,6 +261,7 @@ sub setupSCSI { #------------------------------------------------------------------------------ sub selectKeyboard { + $::live and return; my ($clicked) = $_[0]; return unless $o->{isUpgrade} || !$::beginner || $clicked; @@ -274,6 +278,7 @@ sub selectKeyboard { #------------------------------------------------------------------------------ sub selectInstallClass { + $::live and return; $o->selectInstallClass(@install_classes); $o->{partitions} ||= $suggestedPartitions{$o->{installClass}}; @@ -294,6 +299,7 @@ sub selectInstallClass { #------------------------------------------------------------------------------ sub doPartitionDisks { + $::live and return; $o->{steps}{formatPartitions}{done} = 0; $o->doPartitionDisksBefore; $o->doPartitionDisks; @@ -301,6 +307,7 @@ sub doPartitionDisks { } sub formatPartitions { + $::live and return; unless ($o->{isUpgrade}) { $o->choosePartitionsToFormat($o->{fstab}); $o->formatMountPartitions($o->{fstab}) unless $::testing; @@ -365,6 +372,7 @@ sub installPackages { } #------------------------------------------------------------------------------ sub miscellaneous { + $::live and return; $o->miscellaneous($_[0]); addToBeDone { @@ -389,6 +397,7 @@ sub miscellaneous { #------------------------------------------------------------------------------ sub configureNetwork { + $::live and return; #- get current configuration of network device. log::l("debugging: $o->{netc}{HOSTNAME}"); eval { @@ -406,10 +415,10 @@ sub configureNetwork { $o->configureNetwork($_[1] == 1); } #------------------------------------------------------------------------------ -sub installCrypto { $o->installCrypto } - +sub installCrypto { $::live or $o->installCrypto } #------------------------------------------------------------------------------ sub configureTimezone { + $::live and return; my ($clicked) = @_; my $f = "$o->{prefix}/etc/sysconfig/clock"; @@ -424,9 +433,9 @@ sub configureTimezone { $o->configureTimezone($f, $clicked); } #------------------------------------------------------------------------------ -sub configureServices { $::expert and $o->configureServices } +sub configureServices { $::live or $::expert and $o->configureServices } #------------------------------------------------------------------------------ -sub configurePrinter { $o->configurePrinter($_[0]) } +sub configurePrinter { $::live or $o->configurePrinter($_[0]) } #------------------------------------------------------------------------------ sub setRootPassword { return if $o->{isUpgrade}; @@ -444,12 +453,14 @@ sub addUser { #------------------------------------------------------------------------------ sub createBootdisk { + $::live and return; modules::write_conf($o->{prefix}); $o->createBootdisk($_[1] == 1); } #------------------------------------------------------------------------------ sub setupBootloader { + $::live and return; return if $::g_auto_install; modules::write_conf($o->{prefix}); @@ -462,6 +473,7 @@ sub setupBootloader { } #------------------------------------------------------------------------------ sub configureX { + $::live and return; my ($clicked) = $_[0]; #- done here and also at the end of install2.pm, just in case... @@ -471,12 +483,10 @@ sub configureX { $o->configureX if pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, 'XFree86')) && !$o->{X}{disabled} || $clicked; } #------------------------------------------------------------------------------ -sub generateAutoInstFloppy { - $o->generateAutoInstFloppy; -} +sub generateAutoInstFloppy { $::live or $o->generateAutoInstFloppy } #------------------------------------------------------------------------------ -sub exitInstall { $o->exitInstall(getNextStep() eq "exitInstall") } +sub exitInstall { $::live or $o->exitInstall(getNextStep() eq "exitInstall") } #-###################################################################################### @@ -533,6 +543,7 @@ sub main { readonly => sub { $o->{partitioning}{readonly} = $v ne "0" }, display => sub { $o->{display} = $v }, security => sub { $o->{security} = $v }, + live => sub { $::live = 1 }, test => sub { $::testing = 1 }, patch => sub { $patch = 1 }, defcfg => sub { $cfg = $v }, @@ -556,7 +567,7 @@ sub main { $o->{method} ||= "cdrom"; $o->{mkbootdisk} = 0; } - unless ($::testing) { + unless ($::testing || $::live) { unlink $_ foreach ( $o->{pcmcia} ? () : ("/sbin/install"), #- #- install include cardmgr! "/modules/modules.cgz", "/sbin/insmod", "/sbin/rmmod", @@ -574,8 +585,18 @@ sub main { eval { spawnShell() }; - $o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt"; + $o->{prefix} = $::testing ? "/tmp/test-perl-install" : $::live ? "" : "/mnt"; $o->{root} = $::testing ? "/tmp/root-perl-install" : "/"; + if ($::live) { + @{$o->{orderedSteps}} = grep { /choosePackages/ || /installPackages/ } @{$o->{orderedSteps}}; + my $s; foreach (@{$o->{orderedSteps}}) { + $s->{next} = $_ if $s; + $s = $o->{steps}{$_}; + } + $o->{isUpgrade} = 1; + $::beginner = 0; #- use custom by default. + $::expert = 1; + } mkdir $o->{prefix}, 0755; mkdir $o->{root}, 0755; @@ -606,7 +627,7 @@ sub main { eval { $o = $::o = install_any::loadO($o, "patch") } if $patch; eval { $o = $::o = install_any::loadO($o, $cfg) } if $cfg; - $o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt"; + $o->{prefix} = $::testing ? "/tmp/test-perl-install" : $::live ? "" : "/mnt"; mkdir $o->{prefix}, 0755; modules::unload($_) foreach qw(vfat msdos fat); @@ -695,7 +716,7 @@ sub main { install_any::clean_postinstall_rpms(); install_any::ejectCdrom(); - fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); + $::live or fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); modules::write_conf($o->{prefix}); #- to ensure linuxconf doesn't cry against those files being in the future @@ -703,7 +724,7 @@ sub main { my $now = time - 24 * 60 * 60; utime $now, $now, "$o->{prefix}/$_"; } - install_any::killCardServices(); + $::live or install_any::killCardServices(); #- make sure failed upgrade will not hurt too much. install_steps::cleanIfFailedUpgrade($o); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index cb2211abf..75a5b0dda 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -133,7 +133,7 @@ sub doPartitionDisksBefore { install_any::getFile("XXX"); #- close still opened filehandle eval { fs::umount("/tmp/hdimage") }; } - eval { fs::umount_all($o->{fstab}, $o->{prefix}) } if $o->{fstab} && !$::testing; + eval { fs::umount_all($o->{fstab}, $o->{prefix}) } if $o->{fstab} && !$::testing && !$::live; $o->{raid} ||= {}; } @@ -281,7 +281,7 @@ sub beforeInstallPackages { #- some packages need such files for proper installation. any::writeandclean_ldsoconf($o->{prefix}); - fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); + $::live or fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1"); diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 20d69018b..aa30394b3 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -539,6 +539,7 @@ sub load_rc($) { } sub install_theme { + $::live and return; my ($o, $theme) = @_; $o->{theme} = $theme || $o->{theme} || $themes[0]; @@ -581,6 +582,7 @@ sub create_big_help { #------------------------------------------------------------------------------ sub create_help_window { + $::live and return; my ($o) = @_; # $o->{help_window}->destroy if $o->{help_window}; @@ -632,7 +634,8 @@ sub create_help_window { $o->{help_window} = $w; } -sub set_help { +sub set_help { + $::live and return 1; shift; gtktext_insert($w_help, formatAlaTeX(join "\n", @@ -642,6 +645,7 @@ sub set_help { #------------------------------------------------------------------------------ sub create_steps_window { + $::live and return; my ($o) = @_; my $PIX_H = my $PIX_W = 21; @@ -708,6 +712,7 @@ sub create_steps_window { #------------------------------------------------------------------------------ sub create_logo_window() { + $::live and return; my ($o) = @_; gtkdestroy($o->{logo_window}); my $w = bless {}, 'my_gtk'; diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index dcde8407c..be74d2375 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -247,7 +247,7 @@ sub xmodmap_file { my ($keyboard) = @_; my $f = "$ENV{SHARE_PATH}/xmodmap/xmodmap.$keyboard"; if (! -e $f) { - run_program::run("extract_archive", "$ENV{SHARE_PATH}/xmodmap.cz2", '/tmp', "xmodmap.$keyboard"); + run_program::run("packdrake", "-x", "$ENV{SHARE_PATH}/xmodmap.cz2", '/tmp', "xmodmap.$keyboard"); $f = "/tmp/xmodmap.$keyboard"; } -e $f && $f; diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 490cdee57..f5777151d 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -217,7 +217,7 @@ sub set { my ($lang) = @_; if ($lang && $languages{$lang}) { - #- use extract_archive that follow symlinks and expand directory. + #- use "packdrake -x" that follow symlinks and expand directory. #- it is necessary as there is a lot of symlinks inside locale.cz2, #- using a compressed cpio archive is nighmare to extract all files. #- reset locale environment variable to avoid any warnings by perl, @@ -227,7 +227,7 @@ sub set { eval { commands::rm("-r", "$ENV{SHARE_PATH}/locale") }; require 'run_program.pm'; - run_program::run("extract_archive", "$ENV{SHARE_PATH}/locale.cz2", "$ENV{SHARE_PATH}/locale", $languages{$lang}[2]); + run_program::run("packdrake", "-x", "$ENV{SHARE_PATH}/locale.cz2", "$ENV{SHARE_PATH}/locale", $languages{$lang}[2]); } $ENV{LC_ALL} = $lang; @@ -321,7 +321,7 @@ sub load_po($) { } else { -e ($f = "$_/po.cz2") and last foreach @INC; log::l("trying to load $lang.po from $f"); - open F, "extract_archive $f '' $lang.po 2>/dev/null |"; + open F, "packdrake -x $f '' $lang.po 2>/dev/null |"; } } else { open F, $f; #- not returning here help avoiding reading the same multiple times. diff --git a/perl-install/live_install b/perl-install/live_install new file mode 100755 index 000000000..4f519f0fc --- /dev/null +++ b/perl-install/live_install @@ -0,0 +1,28 @@ +#!../perl + +my $dir = `pwd`; +chomp $dir; +$dir .= "/../../.."; + +#- update /tmp/rhimage which points to top dir of Mandrake CD. +system "/bin/rm", "-rf", "/tmp/rhimage"; +mkdir "/tmp/rhimage", 0700 or die "cannot create directory /tmp/rhimage"; +system "/bin/rm", "-rf", "/tmp/drakx"; +mkdir "/tmp/drakx", 0700 or die "cannot create directory /tmp/drakx\n"; + +#- copy whole set of mdkinst tree and symlink to the CD. +foreach (qw(Mandrake RPMS misc boot images)) { + symlink "$dir/../../$_", "/tmp/rhimage/$_"; +} +system "/bin/cp", "-a", "$dir/../../Mandrake/mdkinst", "/tmp/drakx"; + +#- start the true live_install. +if (-x "/tmp/drakx/mdkinst/usr/bin/perl-install/live_install2") { + chdir "/tmp/drakx/mdkinst/usr/bin/perl-install2"; + system "/tmp/drakx/mdkinst/usr/bin/perl-install/live_install2"; +} else { + print STDERR "unable to get a working live system to start, check your working directory"; +} + +system "/bin/rm", "-rf", "/tmp/drakx"; +system "/bin/rm", "-rf", "/tmp/rhimage"; diff --git a/perl-install/live_install2 b/perl-install/live_install2 new file mode 100755 index 000000000..0773636ea --- /dev/null +++ b/perl-install/live_install2 @@ -0,0 +1,12 @@ +#!../perl + +my $dir = `pwd`; +chomp $dir; +$dir .= "/../../.."; + +$ENV{PERL5LIB} = join ":", map { "$dir/$_" } @INC; +$ENV{LD_LIBRARY_PATH} = "$dir/lib:$dir/usr/lib"; +$ENV{PATH} = join(":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin") . ":$ENV{PATH}"; +$ENV{SHARE_PATH} = "$dir/usr/share"; + +exec "../../../lib/ld-linux.so.2", "../perl", "./install2", "--live", @ARGV or die; diff --git a/perl-install/modules.pm b/perl-install/modules.pm index cdee937ee..c2075f453 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -372,9 +372,11 @@ sub load { if ($::testing) { log::l("i try to install $name module (@options)"); + } elsif ($::live) { + return run_program::run("modprobe", $name, @options); } else { $conf{$name}{loaded} and return; - + eval { load($_, 'prereq') } foreach @{$deps{$name}}; load_raw([ $name, @options ]); } @@ -413,7 +415,7 @@ sub unload { sub load_raw { my @l = map { my ($i, @i) = @$_; [ $i, \@i ] } grep { $_->[0] !~ /ignore/ } @_; my $cz = "/lib/modules" . (arch() eq 'sparc64' && "64") . ".cz"; -e $cz or $cz .= "2"; - run_program::run("extract_archive", $cz, "/tmp", map { "$_->[0].o" } @l); + run_program::run("packdrake", "-x", $cz, "/tmp", map { "$_->[0].o" } @l); my @failed = grep { my $m = "/tmp/$_->[0].o"; if (-e $m && run_program::run(["insmod_", "insmod"], "-f", $m, @{$_->[1]})) { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 0b8339e5f..021d61657 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -171,7 +171,7 @@ sub extractHeaders($$$) { cleanHeaders($prefix); - run_program::run("extract_archive", + run_program::run("packdrake", "-x", "/tmp/$medium->{hdlist}", "$prefix/tmp/headers", map { packageHeaderFile($_) } @$pkgs); @@ -468,7 +468,7 @@ sub psUsingHdlist { #- extract filename from archive, this take advantage of verifying #- the archive too. - open F, "extract_archive $newf |"; + open F, "packdrake $newf |"; foreach () { chomp; /^[dlf]\s+/ or next; @@ -754,7 +754,8 @@ sub init_db { if ($isUpgrade) { c::rpmdbRebuild($prefix) or die "rebuilding of rpm database failed: ", c::rpmErrorString(); } - c::rpmdbInit($prefix, 0644) or die "creation of rpm database failed: ", c::rpmErrorString(); + #- seems no more necessary to rpmdbInit ? + #c::rpmdbOpen($prefix) or die "creation of rpm database failed: ", c::rpmErrorString(); } sub done_db { @@ -1116,10 +1117,11 @@ sub install($$$;$$) { } else { #- child process will run each transaction. $SIG{SEGV} = sub { log::l("segmentation fault on transactions"); c::_exit(0) }; + my $db; eval { close INPUT; select((select(OUTPUT), $| = 1)[0]); - my $db = c::rpmdbOpen($prefix) or die "error opening RPM database: ", c::rpmErrorString(); + $db = c::rpmdbOpen($prefix) or die "error opening RPM database: ", c::rpmErrorString(); my $trans = c::rpmtransCreateSet($db, $prefix); log::l("opened rpm database for transaction of ". scalar @transToInstall ." new packages, still $nb after that to do"); @@ -1151,10 +1153,11 @@ sub install($$$;$$) { c::rpmdbClose($db); die "installation of rpms failed:\n ", join("\n ", @probs); } - c::rpmdbClose($db); - log::l("rpm database closed"); }; $@ and print OUTPUT "die:$@\n"; + c::rpmdbClose($db); + log::l("rpm database closed"); + close OUTPUT; c::_exit(0); } diff --git a/perl-install/share/list b/perl-install/share/list index c1112ce32..36017bbc1 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -20,7 +20,7 @@ /usr/X11R6/lib/X11/Cards /usr/X11R6/lib/modules/xf86Wacom.so /usr/bin/bzip2 -/usr/bin/extract_archive +/usr/bin/packdrake /usr/bin/perl /usr/lib/gconv/BIG5.so /usr/lib/gconv/EUC-JP.so -- cgit v1.2.1