summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-08-13 19:49:27 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-08-13 19:49:27 +0000
commit30bd557eb1cdb81ef2bac4d435714b1b9e985ff5 (patch)
treee1a37dc7954a9b1924510039033af97de84eda69 /perl-install
parent99d1d3f6512c77f34b863e3b0e1ce1a4ebccc072 (diff)
downloaddrakx-backup-do-not-use-30bd557eb1cdb81ef2bac4d435714b1b9e985ff5.tar
drakx-backup-do-not-use-30bd557eb1cdb81ef2bac4d435714b1b9e985ff5.tar.gz
drakx-backup-do-not-use-30bd557eb1cdb81ef2bac4d435714b1b9e985ff5.tar.bz2
drakx-backup-do-not-use-30bd557eb1cdb81ef2bac4d435714b1b9e985ff5.tar.xz
drakx-backup-do-not-use-30bd557eb1cdb81ef2bac4d435714b1b9e985ff5.zip
auto_inst enhancements
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install2.pm23
-rw-r--r--perl-install/install_any.pm14
-rw-r--r--perl-install/install_steps_auto_install.pm66
-rw-r--r--perl-install/steps.pm1
4 files changed, 55 insertions, 49 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index e838db001..5b7bd7805 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -76,8 +76,8 @@ $o = $::o = {
sub installStepsCall {
my ($o, $auto, $fun, @args) = @_;
- eval($auto ? "install_steps::$fun".'($o, @args)' : '$o->'."$fun".'(@args)');
- #- TODO check $@ (when the method doesn't exist for example) ? I fail to do that
+ $fun = "install_steps::$fun" if $auto;
+ $o->$fun(@args);
}
#-######################################################################################
@@ -167,8 +167,8 @@ sub formatPartitions {
my ($clicked, $ent_number, $auto) = @_;
$o->{steps}{choosePackages}{done} = 0;
- installStepsCall($o, $auto, 'choosePartitionsToFormat', $o->{fstab}) unless $o->{isUpgrade};
- installStepsCall($o, $auto, 'formatMountPartitions', $o->{fstab}) unless $::testing;
+ installStepsCall($o, $auto, 'choosePartitionsToFormat', $o->{fstab}) if !$o->{isUpgrade};
+ installStepsCall($o, $auto, 'formatMountPartitions', $o->{fstab}) if !$::testing;
mkdir "$o->{prefix}/$_", 0755 foreach
qw(dev etc etc/profile.d etc/rpm etc/sysconfig etc/sysconfig/console
@@ -328,12 +328,13 @@ sub exitInstall {
#-######################################################################################
sub main {
$SIG{__DIE__} = sub { chomp(my $err = $_[0]); log::l("warning: $err") };
- $SIG{SEGV} = sub { my $msg = "segmentation fault: seems like memory is missing as the install crashes"; print "$msg\n"; log::l($msg);
- $o->ask_warn('', $msg);
- setVirtual(1);
- require install_steps_auto_install;
- install_steps_auto_install::errorInStep();
- };
+ $SIG{SEGV} = sub {
+ my $msg = "segmentation fault: seems like memory is missing as the install crashes"; print "$msg\n"; log::l($msg);
+ $o->ask_warn('', $msg);
+ setVirtual(1);
+ require install_steps_auto_install;
+ install_steps_auto_install_non_interactive::errorInStep ();
+ };
$ENV{PERL_BADLANG} = 1;
umask 022;
@@ -454,7 +455,7 @@ sub main {
undef $::auto_install;
} else {
print "Error using auto_install\n$@\n";
- install_steps_auto_install::errorInStep();
+ install_steps_auto_install_non_interactive::errorInStep ();
}
} else {
log::l("auto install config file loaded successfully");
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 3e50d5b9c..9373a1bb6 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -666,7 +666,7 @@ sub getAndSaveInstallFloppy {
my $image = cat_("/proc/cmdline") =~ /pcmcia/ ? "pcmcia" :
${{ hd => 'hd', cdrom => 'cdrom', ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}};
$image .= arch() =~ /sparc64/ && "64"; #- for sparc64 there are a specific set of image.
- install_any::getAndSaveFile("images/$image.img", $where) or log::l("failed to write Install Floppy ($image.img) to $where"), return;
+ getAndSaveFile("images/$image.img", $where) or log::l("failed to write Install Floppy ($image.img) to $where"), return;
1;
}
@@ -680,7 +680,7 @@ sub getAndSaveAutoInstallFloppy {
my $mountdir = "$o->{prefix}/tmp/mount"; -d $mountdir or mkdir $mountdir, 0755;
my $workdir = "$o->{prefix}/tmp/work"; -d $workdir or rmdir $workdir;
- install_any::getAndSaveInstallFloppy($o, $imagefile) or return;
+ getAndSaveInstallFloppy($o, $imagefile) or return;
devices::make($_) foreach qw(/dev/loop6 /dev/ram);
require commands;
@@ -691,7 +691,7 @@ sub getAndSaveAutoInstallFloppy {
run_program::run("losetup", "-d", "/dev/loop6");
substInFile { s/timeout.*//; s/^(\s*append\s*=\s*\".*)\"/$1 kickstart=floppy\"/ } "$workdir/silo.conf"; #" for po
-#-TODO output "$workdir/ks.cfg", install_any::generate_ks_cfg($o);
+#-TODO output "$workdir/ks.cfg", generate_ks_cfg($o);
output "$workdir/boot.msg", "\n7m",
"!! If you press enter, an auto-install is going to start.
ALL data on this computer is going to be lost,
@@ -699,7 +699,7 @@ sub getAndSaveAutoInstallFloppy {
", "7m\n";
local $o->{partitioning}{clearall} = 1;
- output("$workdir/auto_inst.cfg", install_any::g_auto_install());
+ output("$workdir/auto_inst.cfg", g_auto_install());
run_program::run("genromfs", "-d", $workdir, "-f", "/dev/ram", "-A", "2048,/..", "-a", "512", "-V", "DrakX autoinst");
fs::mount("/dev/ram", $mountdir, 'romfs', 0);
@@ -712,9 +712,9 @@ sub getAndSaveAutoInstallFloppy {
my $imagefile = "$o->{prefix}/tmp/autoinst.img";
my $mountdir = "$o->{prefix}/tmp/mount"; -d $mountdir or mkdir $mountdir, 0755;
- my $param = 'kickstart=floppy ' . install_any::generate_automatic_stage1_params($o);
+ my $param = 'kickstart=floppy ' . generate_automatic_stage1_params($o);
- install_any::getAndSaveInstallFloppy($o, $imagefile) or return;
+ getAndSaveInstallFloppy($o, $imagefile) or return;
my $dev = devices::set_loop($imagefile) or log::l("couldn't set loopback device"), return;
fs::mount($dev, $mountdir, 'vfat', 0);
@@ -732,7 +732,7 @@ sub getAndSaveAutoInstallFloppy {
", "07\n" if !$replay;
local $o->{partitioning}{clearall} = !$replay;
- output("$mountdir/auto_inst.cfg", install_any::g_auto_install($replay));
+ output("$mountdir/auto_inst.cfg", g_auto_install($replay));
fs::umount($mountdir);
commands::dd("if=$imagefile", "of=$where", "bs=1440", "count=1024");
diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm
index a7870240d..50757224b 100644
--- a/perl-install/install_steps_auto_install.pm
+++ b/perl-install/install_steps_auto_install.pm
@@ -2,20 +2,15 @@ package install_steps_auto_install; # $Id$
use diagnostics;
use strict;
-use lang;
use vars qw(@ISA $graphical @graphical_steps);
@ISA = qw(install_steps);
-use modules;
-
-
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use install_steps;
-use log;
sub new {
my ($type, $o) = @_;
@@ -31,20 +26,46 @@ sub new {
@ISA = ($interactiveClass, @ISA);
- #- remove our non-interactive stuff
- eval "undef *$_" foreach qw(configureNetwork enteringStep ask_warn wait_message errorInStep installPackages);
-
- my $f = $o->{steps}{first};
- do {
- member($f, @{$o->{interactiveSteps}}) ? $o->{steps}{$f}{noauto} = 1 : $o->{steps}{$f}{auto} = 1;
- } while ($f = $o->{steps}{$f}{next});
+ for (my $f = $o->{steps}{first}; $f; $f = $o->{steps}{$f}{next}) {
+ my $auto_name = member($f, @{$o->{interactiveSteps}}) ? 'noauto' : 'auto';
+ $o->{steps}{$f}{$auto_name} = 1;
+ }
goto &{$::{$interactiveClass . "::"}{new}};
} else {
- (bless {}, ref $type || $type)->SUPER::new($o);
+ @ISA = ('install_steps_auto_install_non_interactive', @ISA);
+ (bless {}, ref $type || $type)->install_steps::new($o);
+ }
+}
+
+
+sub exitInstall {
+ my ($o, $alldone) = @_;
+ return if $o->{autoExitInstall};
+
+ if ($o->{interactive}) {
+ (bless $o, "install_steps_$o->{interactive}")->exitInstall($alldone);
+ } else {
+ install_steps::exitInstall($o);
+ print "\a";
+ print "Auto installation complete (the postInstall is not done yet though)\n";
+ print "Press <Enter> to reboot\n";
+ <STDIN>;
}
}
+
+#-######################################################################################
+#- install_steps_auto_install_non_interactive package
+#-######################################################################################
+package install_steps_auto_install_non_interactive;
+
+use install_steps;
+use lang;
+use modules;
+use common;
+use log;
+
sub configureNetwork {
my ($o) = @_;
modules::load_thiskind('net');
@@ -54,7 +75,7 @@ sub configureNetwork {
sub enteringStep {
my ($o, $step) = @_;
print _("Entering step `%s'\n", translate($o->{steps}{$step}{text}));
- $o->SUPER::enteringStep($step);
+ $o->install_steps::enteringStep($step);
}
sub ask_warn {
@@ -77,7 +98,7 @@ sub errorInStep {
#-######################################################################################
sub selectLanguage {
my ($o) = @_;
- $o->SUPER::selectLanguage;
+ $o->install_steps::selectLanguage;
lang::load_console_font($o->{lang});
}
@@ -86,19 +107,4 @@ sub installPackages {
catch_cdie { $o->install_steps::installPackages($packages) } sub { print "$@\n"; 1 }
}
-sub exitInstall {
- my ($o, $alldone) = @_;
- return if $o->{autoExitInstall};
-
- if ($o->{interactive}) {
- (bless $o, "install_steps_$o->{interactive}")->exitInstall($alldone);
- } else {
- install_steps::exitInstall($o);
- print "\a";
- print "Auto installation complete (the postInstall is not done yet though)\n";
- print "Press <Enter> to reboot\n";
- <STDIN>;
- }
-}
-
1;
diff --git a/perl-install/steps.pm b/perl-install/steps.pm
index e5e522c1e..9fca2354f 100644
--- a/perl-install/steps.pm
+++ b/perl-install/steps.pm
@@ -24,7 +24,6 @@ use common;
setRootPassword => [ __("Set root password"), 1, 1, '', "installPackages", 'rootpasswd' ],
addUser => [ __("Add a user"), 1, 1, '', "installPackages", 'user' ],
configureNetwork => [ __("Configure networking"), 1, 1, '', "formatPartitions", 'network' ],
-#- installCrypto => [ __("Cryptographic"), 1, 1, '!$::expert', "configureNetwork" ],
summary => [ __("Summary"), 1, 0, '', "installPackages", 'default' ],
configureServices => [ __("Configure services"), 1, 1, '!$::expert', "installPackages", 'services' ],
if_((arch() !~ /alpha/) && (arch() !~ /ppc/),