diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-09-13 22:03:33 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-09-13 22:03:33 +0000 |
commit | 23c152b7d199b290607b3d3e3a14d76dbaa60e90 (patch) | |
tree | 495014e3fa3d0e8266f5d243381bbcbb94ae35be /perl-install | |
parent | b121ba06131e915ff2dd837c8d7d0bd13fb3ac40 (diff) | |
download | drakx-backup-do-not-use-23c152b7d199b290607b3d3e3a14d76dbaa60e90.tar drakx-backup-do-not-use-23c152b7d199b290607b3d3e3a14d76dbaa60e90.tar.gz drakx-backup-do-not-use-23c152b7d199b290607b3d3e3a14d76dbaa60e90.tar.bz2 drakx-backup-do-not-use-23c152b7d199b290607b3d3e3a14d76dbaa60e90.tar.xz drakx-backup-do-not-use-23c152b7d199b290607b3d3e3a14d76dbaa60e90.zip |
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Xconfigurator_consts.pm | 3 | ||||
-rw-r--r-- | perl-install/devices.pm | 2 | ||||
-rw-r--r-- | perl-install/fs.pm | 2 | ||||
-rw-r--r-- | perl-install/install2.pm | 116 | ||||
-rw-r--r-- | perl-install/install_any.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 11 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 10 | ||||
-rw-r--r-- | perl-install/modules.pm | 4 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 2 |
9 files changed, 102 insertions, 50 deletions
diff --git a/perl-install/Xconfigurator_consts.pm b/perl-install/Xconfigurator_consts.pm index 1f7529164..b279bbde9 100644 --- a/perl-install/Xconfigurator_consts.pm +++ b/perl-install/Xconfigurator_consts.pm @@ -12,8 +12,7 @@ use common qw(:common); $resolution_wanted = "1024x768"; @resolutions = qw(640x480 800x600 1024x768 1152x864 1280x1024 1600x1200); - -@accelservers = qw(S3 Mach32 Mach8 8514 P9000 AGX W32 Mach64 I128 S3V 3DLabs); +@accelservers = qw(S3 Mach32 Mach8 8514 P9000 AGX W32 Mach64 Rage128 I128 S3V 3DLabs); @allservers = (qw(Mono VGA16 SVGA), @accelservers); %videomemory = ( diff --git a/perl-install/devices.pm b/perl-install/devices.pm index f29ac194b..877e22680 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -103,7 +103,7 @@ sub make($) { #- make a directory for this inode if needed. mkdir dirname($file), 0755; - syscall_('mknod', $file, $type | 0600, makedev($major, $minor)) or die "mknod failed (dev:$_): $!"; + syscall_('mknod', $file, $type | 0600, makedev($major, $minor)) or die "mknod failed (dev $_): $!"; $file; } diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 45045e508..d597140a9 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -208,6 +208,8 @@ sub write($$) { } write_fstab($fstab, $prefix, $cddev); + return if $::g_auto_install; + devices::make "$prefix/dev/$_->{device}" foreach grep { $_->{device} && !isNfs($_) } @$fstab; } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index e43b47ded..e28c8a9a2 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -2,6 +2,7 @@ package install2; use diagnostics; use strict; +use Data::Dumper; use vars qw($o); @@ -16,6 +17,7 @@ use lang; use keyboard; use fs; use fsedit; +use devices; use partition_table qw(:types); use pkgs; use printer; @@ -23,8 +25,6 @@ use modules; use detect_devices; use modparm; use run_program; -use install_steps_graphical; - #-###################################################################################### #- Steps table @@ -260,12 +260,12 @@ my %suggestedPartitions = ( #-if you want to do a kickstart file, you just have to add all the required fields (see for example #-the variable $default) #-####################################################################################### -$o = $::o = { +$o = { bootloader => { onmbr => 1, linear => 0 }, autoSCSI => 0, mkbootdisk => 1, #- no mkbootdisk if 0 or undef, find a floppy with 1 #- packages => [ qw() ], - partitioning => { clearall => $::testing, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0 }, + partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0 }, #- partitions => [ #- { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, #- { mntpoint => "/", size => 256 << 11, type => 0x83 }, @@ -349,11 +349,9 @@ sub selectLanguage { $o->selectLanguage; addToBeDone { - unless ($o->{isUpgrade}) { - lang::write($o->{prefix}); - keyboard::write($o->{prefix}, $o->{keyboard}); - } - } 'doInstallStep'; + lang::write($o->{prefix}); + keyboard::write($o->{prefix}, $o->{keyboard}); + } 'doInstallStep' unless $o->{isUpgrade} || $::g_auto_install; } #------------------------------------------------------------------------------ @@ -364,8 +362,8 @@ sub selectKeyboard { $o->selectKeyboard; #- if we go back to the selectKeyboard, you must rewrite addToBeDone { - keyboard::write($o->{prefix}, $o->{keyboard}) unless $o->{isUpgrade}; - } 'doInstallStep'; + keyboard::write($o->{prefix}, $o->{keyboard}); + } 'doInstallStep' unless $o->{isUpgrade} || $::g_auto_install; } #------------------------------------------------------------------------------ @@ -382,7 +380,7 @@ sub selectInstallClass { $::expert = $o->{installClass} eq "expert"; $::beginner = $o->{installClass} eq "beginner"; - $o->{partitions} = $suggestedPartitions{$o->{installClass}}; + $o->{partitions} ||= $suggestedPartitions{$o->{installClass}}; install_any::setPackages($o, \@install_classes) if $o->{steps}{choosePackages}{entered} > 1; } @@ -396,7 +394,6 @@ sub setupSCSI { } #------------------------------------------------------------------------------ -#-PADTODO sub partitionDisks { $o->{drives} = [ detect_devices::hds() ]; $o->{hds} = catch_cdie { fsedit::hds($o->{drives}, $o->{partitioning}) } @@ -492,7 +489,7 @@ sub addUser { #------------------------------------------------------------------------------ #-PADTODO sub createBootdisk { - fs::write($o->{prefix}, $o->{fstab}) unless $o->{isUpgrade}; + fs::write($o->{prefix}, $o->{fstab}); modules::write_conf("$o->{prefix}/etc/conf.modules", 'append'); $o->createBootdisk($_[1] == 1); } @@ -516,6 +513,25 @@ sub exitInstall { $o->exitInstall } sub main { $SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") }; + $::beginner = $::expert = $::g_auto_install = 0; + while (@_) { + local $_ = shift; + if (/--method/) { + $o->{method} = shift; + } elsif (/--step/) { + $o->{steps}{first} = shift; + } elsif (/--expert/) { + $::expert = 1; + } elsif (/--beginner/) { + $::beginner = 1; + #} elsif (/--ks/ || /--kickstart/) { + # $::auto_install = 1; + } elsif (/--g_auto_install/) { + $::testing = $::g_auto_install = 1; + $o->{partitioning}{auto_allocate} = 1; + } + } + #- if this fails, it's okay -- it might help with free space though unlink "/sbin/install" unless $::testing; unlink "/sbin/insmod" unless $::testing; @@ -525,6 +541,10 @@ sub main { log::l("second stage install running"); log::ld("extra log messages are enabled"); + #-really needed ?? + spawnSync(); + eval { spawnShell() }; + $o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt"; mkdir $o->{prefix}, 0755; @@ -532,14 +552,39 @@ sub main { $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin"; $ENV{LD_LIBRARY_PATH} = ""; - #-really needed ?? - spawnSync(); - eval { spawnShell() }; + if ($::auto_install) { + require 'install_steps.pm'; + fs::mount(devices::make("fd0"), "/mnt", "vfat", 0); + + my $O = $o; + my $f = "/mnt/auto_inst.cfg"; + { + local *F; + open F, $f or die _("Error reading file $f"); + + local $/ = "\0"; + eval <F>; + } + $@ and die _("Bad kickstart file %s (failed %s)", $f, $@); + fs::umount("/mnt"); + add2hash($o, $O); + } else { + require 'install_steps_graphical.pm'; + } + + $o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt"; + mkdir $o->{prefix}, 0755; + + #- make sure we don't pick up any gunk from the outside world + $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin"; + $ENV{LD_LIBRARY_PATH} = ""; #- needed very early for install_steps_graphical $o->{mouse} = install_any::mouse_detect() unless $::testing || $o->{mouse}; - $o = install_steps_graphical->new($o); + $::o = $o = $::auto_install ? + install_steps->new($o) : + install_steps_graphical->new($o); $o->{netc} = network::read_conf("/tmp/network"); if (my ($file) = glob_('/tmp/ifcfg-*')) { @@ -549,29 +594,15 @@ sub main { } modules::load_deps("/modules/modules.dep"); - modules::get_stage1_conf("/tmp/conf.modules"); + $o->{modules} = modules::get_stage1_conf($o->{modules}, "/tmp/conf.modules"); modules::read_already_loaded(); modparm::read_modparm_file("/usr/share/modparm.lst"); - while (@_) { - local $_ = shift; - if (/--method/) { - $o->{method} = $_ = shift; - if (/ftp/) { - require 'ftp.pm'; - local $^W = 0; - *install_any::getFile = \&ftp::getFile; - } - } elsif (/--step/) { - $o->{steps}{first} = shift; - } elsif (/--expert/) { - $::expert = 1; - } else { - $::expert = 0; - } - + if ($o->{method} && $o->{method} eq "ftp") { + require 'ftp.pm'; + local $^W = 0; + *install_any::getFile = \&ftp::getFile; } - #-the main cycle my $clicked = 0; @@ -581,6 +612,7 @@ sub main { eval { &{$install2::{$o->{step}}}($clicked, $o->{steps}{$o->{step}}{entered}); }; + $o->kill_action; $clicked = 0; while ($@) { local $_ = $@; @@ -599,6 +631,16 @@ sub main { killCardServices(); log::l("installation complete, leaving"); + + if ($::g_auto_install) { + my $h = $o; $o = {}; + $h->{$_} and $o->{$_} = $h->{$_} foreach qw(lang autoSCSI printer mouse netc timezone bootloader superuser intf keyboard mkbootdisk base user modules installClass partitions); + + delete $o->{user}{password2}; + delete $o->{superuser}{password2}; + + print Data::Dumper->Dump([$o], ['$o']), "\0"; + } } sub killCardServices { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 0820eb24e..f9b604bc6 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -98,7 +98,7 @@ sub getAvailableSpace { sub setPackages($$) { my ($o, $install_classes) = @_; - unless ($o->{package}) { + unless ($o->{packages}) { my $useHdlist = $o->{method} !~ /nfs|hd/; eval { $o->{packages} = pkgs::psUsingHdlist() } if $useHdlist; $o->{packages} = pkgs::psUsingDirectory() if !$useHdlist || $@; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 584bf1fb3..4736a98c9 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -40,7 +40,6 @@ sub new($$) { sub enteringStep($$) { my ($o, $step) = @_; log::l("starting step `$step'"); - $o->kill; for (my $s = $o->{steps}{first}; $s; $s = $o->{steps}{$s}{next}) { @@ -69,7 +68,8 @@ so continue at your own risk :("), $@ ]) if $@; } } -sub errorInStep($$) {} +sub errorInStep($$) { print "error :(\n"; exit 1 } +sub kill_action {} #-###################################################################################### @@ -99,7 +99,8 @@ sub setupSCSI { modules::load_thiskind('scsi') } #------------------------------------------------------------------------------ sub doPartitionDisks($$) { my ($o, $hds) = @_; - fsedit::auto_allocate($hds, $o->{partitions}); + return if $::testing; + partition_table::write($_) foreach $hds; } #------------------------------------------------------------------------------ @@ -210,8 +211,7 @@ sub setRootPassword($) { $u{password} = crypt_($u{password}) if $u{password}; - my $f = "$p/etc/passwd"; - my @lines = cat_($f, "failed to open file $f"); + my @lines = cat_(my $f = "$p/etc/passwd") or log::l("missing passwd file"), return; local *F; open F, "> $f" or die "failed to write file $f: $!\n"; @@ -273,6 +273,7 @@ sub createBootdisk($) { #------------------------------------------------------------------------------ sub setupBootloader($) { my ($o) = @_; + return if $::g_auto_install; my $versionString = versionString(); lilo::install($o->{prefix}, $o->{hds}, $o->{fstab}, $versionString, $o->{bootloader}); } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 4bb7e6aab..6bff4e7ff 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -35,6 +35,10 @@ sub errorInStep($$) { $o->ask_warn(_("Error"), [ _("An error occurred"), $err ]); } +sub kill_action { + my ($o) = @_; + $o->kill; +} #-###################################################################################### #- Steps Functions @@ -175,7 +179,7 @@ _("Please enter the IP configuration for this machine. Each item should be entered as an IP address in dotted-decimal notation (for example, 1.2.3.4)."), [ _("IP address:"), _("Netmask:")], - [ \$intf->{IPADDR}, \$intf->{NETMASK}], + [ \$intf->{IPADDR}, \$intf->{NETMASK} ], complete => sub { for (my $i = 0; $i < @fields; $i++) { unless (network::is_ip($intf->{$fields[$i]})) { @@ -202,7 +206,7 @@ _("Please enter your host name. Your host name should be a fully-qualified host name, such as ``mybox.mylab.myco.com''. Also give the gateway if you have one"), - [_("Host name:"), _("DNS server:"), _("Gateway:"), _("Gateway device:")], + [_("Host name:"), _("DNS server:"), _("Gateway:"), !$::beginner ? _("Gateway device:") : ()], [(map { \$netc->{$_}} qw(HOSTNAME dnsServer GATEWAY)), {val => \$netc->{GATEWAYDEV}, list => \@devices}] ); @@ -214,7 +218,7 @@ sub timeConfig { $o->{timezone}{GMT} = $o->ask_yesorno('', _("Is your hardware clock set to GMT?"), $o->{timezone}{GMT}); $o->{timezone}{timezone} ||= timezone::bestTimezone(lang::lang2text($o->{lang})); - $o->{timezone}{timezone} = $o->ask_from_list('', _("In which timezone are you"), [ timezone::getTimeZones($o->{prefix}) ], $o->{timezone}{timezone}); + $o->{timezone}{timezone} = $o->ask_from_list('', _("In which timezone are you"), [ timezone::getTimeZones($::g_auto_install ? '' : $o->{prefix}) ], $o->{timezone}{timezone}); install_steps::timeConfig($o,$f); } diff --git a/perl-install/modules.pm b/perl-install/modules.pm index d0c38d49c..22584aa1b 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -285,10 +285,12 @@ sub write_conf { } sub get_stage1_conf { - %conf = read_conf($_[0], \$scsi); + %conf = read_conf($_[1], \$scsi); + add2hash(\%conf, $_[0]); $conf{parport_lowlevel}{alias} ||= "parport_pc"; $conf{pcmcia_core}{"pre-install"} ||= "/etc/rc.d/init.d/pcmcia start"; $conf{plip}{"pre-install"} ||= "modprobe parport_pc ; echo 7 > /proc/parport/0/irq"; + \%conf; } sub load_thiskind($;&) { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 6a6bf002d..c14b8ebc1 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -263,6 +263,8 @@ sub getHeader($) { sub install { my ($prefix, $toInstall, $isUpgrade, $force) = @_; + return if $::g_auto_install; + c::rpmReadConfigFiles() or die "can't read rpm config files"; my $db = c::rpmdbOpen($prefix) or die "error opening RPM database: ", c::rpmErrorString(); |