summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Xconfigurator.pm44
-rw-r--r--perl-install/any.pm18
-rw-r--r--perl-install/install2.pm2
-rw-r--r--perl-install/install_steps_interactive.pm26
-rw-r--r--perl-install/interactive.pm10
-rw-r--r--perl-install/interactive_gtk.pm4
-rw-r--r--perl-install/my_gtk.pm14
-rw-r--r--perl-install/printerdrake.pm24
-rwxr-xr-xperl-install/standalone/keyboarddrake12
-rwxr-xr-xperl-install/standalone/mousedrake2
10 files changed, 91 insertions, 65 deletions
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm
index 739d542ec..ffa57f784 100644
--- a/perl-install/Xconfigurator.pm
+++ b/perl-install/Xconfigurator.pm
@@ -181,7 +181,7 @@ sub cardConfiguration(;$$$) {
add2hash($card, cardConfigurationAuto()) unless $card->{server} || $noauto;
$card->{server} = 'FBDev' unless !$allowFB || $card->{server} || $card->{type} || $noauto;
$card->{type} = cardName2RealName($in->ask_from_treelist(_("Graphic card"), _("Select a graphic card"), '|', ['Other|Unlisted', readCardsNames()])) unless $card->{type} || $card->{server};
- undef $card->{type}, $card->{server} = $in->ask_from_list(_("X server"), _("Choose a X server"), $allowFB ? \@allservers : \@allbutfbservers ) if $card->{type} eq 'Other|Unlisted';
+ undef $card->{type}, $card->{server} = $in->ask_from_list(_("X server"), _("Choose a X server"), $allowFB ? \@allservers : \@allbutfbservers ) or return if $card->{type} eq 'Other|Unlisted';
updateCardAccordingName($card, $card->{type}) if $card->{type};
add2hash($card, { vendor => "Unknown", board => "Unknown" });
@@ -283,7 +283,7 @@ NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", $xf3_ver)) . "
#- examine choice of user, beware the list MUST NOT BE REORDERED AS the first item should be the
#- proposed one by DrakX.
- my $tc = $in->ask_from_listf(_("XFree configuration"), formatAlaTeX($msg), sub { translate($_[0]{text}) }, \@choices);
+ my $tc = $in->ask_from_listf(_("XFree configuration"), formatAlaTeX($msg), sub { translate($_[0]{text}) }, \@choices) or return;
#- in case of class discarding, this can help ...
$tc or $tc = $choices[0];
$tc->{code} and $tc->{code}();
@@ -318,7 +318,7 @@ NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", $xf3_ver)) . "
$videomemory{$in->ask_from_list_('',
_("Select the memory size of your graphic card"),
[ sort { $videomemory{$a} <=> $videomemory{$b} }
- keys %videomemory])};
+ keys %videomemory]) || return};
#- hack for ATI Mach64 cards where two options should be used if using Utah-GLX.
@@ -1085,23 +1085,31 @@ sub main {
my $quit;
until ($ok || $quit) {
+ ref($in) =~ /discard/ and die "automatic X configuration failed, ensure you give hsyncrange and vsyncrange with non-DDC aware videocards/monitors";
- my %c = my @c = (
- __("Change Monitor") => sub { $o->{monitor} = monitorConfiguration() },
- __("Change Graphic card") => sub { $o->{card} = cardConfiguration('', 'noauto', $allowFB) },
- if_($::expert,
- __("Change Server options") => sub { optionsConfiguration($o) }),
- __("Change Resolution") => sub { resolutionsConfiguration($o) },
- __("Show information") => sub { show_info($o) },
- __("Test again") => sub { $ok = testFinalConfig($o, 1) },
- __("Quit") => sub { $quit = 1 },
- );
$in->set_help('configureXmain') unless $::isStandalone;
- my $f = $in->ask_from_list_(['XFdrake'],
- _("What do you want to do?"),
- [ grep { !ref } @c ]) or die "automatic X configuration failed, ensure you give hsyncrange and vsyncrange with non-DDC aware videocards/monitors";
- eval { &{$c{$f}} };
- !$@ || $@ =~ /ask_from_list cancel/ or die;
+
+ my $f;
+ $in->ask_from_entries_refH_powered(
+ {
+ title => 'XFdrake',
+ messages => _("What do you want to do?"),
+ ok => '',
+ }, [
+ { format => sub { $_[0][0] }, val => \$f,
+ list => [
+ [ __("Change Monitor") => sub { $o->{monitor} = monitorConfiguration() } ],
+ [ __("Change Graphic card") => sub { $o->{card} = cardConfiguration('', 'noauto', $allowFB) } ],
+ if_($::expert,
+ [ __("Change Server options") => sub { optionsConfiguration($o) } ]),
+ [ __("Change Resolution") => sub { resolutionsConfiguration($o) } ],
+ [ __("Show information") => sub { show_info($o) } ],
+ [ __("Test again") => sub { $ok = testFinalConfig($o, 1) } ],
+ [ __("Quit") => sub { $quit = 1 } ],
+ ],
+ }
+ ]);
+ $f->[1]->();
$in->kill;
}
if (!$ok) {
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 2b65ca7c4..6ea56b645 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -101,7 +101,7 @@ sub setupBootloader {
if (arch() =~ /sparc/) {
$b->{use_partition} = $in->ask_from_list_(_("SILO Installation"),
_("Where do you want to install the bootloader?"),
- \@l, $l[$b->{use_partition}]);
+ \@l, $l[$b->{use_partition}]) or return;
} else {
my $boot = $hds->[0]{device};
my $onmbr = "/dev/$boot" eq $b->{boot};
@@ -169,17 +169,21 @@ sub setupBootloader {
while ($::expert || $more > 1) {
$in->set_help(arch() =~ /sparc/ ? 'setupSILOAddEntry' : 'setupBootloaderAddEntry') unless $::isStandalone;
- my $c = $in->ask_from_listf([''],
+ my $c;
+ $in->ask_from_entries_refH_powered(
+ {
+ messages =>
_("Here are the different entries.
You can add some more or change the existing ones."),
- sub {
+ ok => '',
+},
+ [ { val => \$c, format => sub {
my ($e) = @_;
ref $e ?
"$e->{label} ($e->{kernel_or_dev})" . ($b->{default} eq $e->{label} && " *") :
translate($e);
- },
- [ @{$b->{entries}}, __("Add"), __("Done") ]);
-
+ }, list => [ @{$b->{entries}}, __("Add"), __("Done") ] } ]
+ );
$c eq "Done" and last;
my ($e);
@@ -553,7 +557,7 @@ sub setup_thiskind {
my $opt = [ __("Yes"), __("No") ];
push @$opt, __("See hardware info") if $::expert;
my $r = "Yes";
- $r = $in->ask_from_list_('', $msg, $opt, "No") unless $at_least_one && @l == 0;
+ $r = $in->ask_from_list_('', $msg, $opt, "No") || die 'already displayed' unless $at_least_one && @l == 0;
if ($r eq "No") { return @l }
if ($r eq "Yes") {
push @l, load_module($in, $type) || next;
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index f1464ce1e..2f5c3f47a 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -584,7 +584,7 @@ sub main {
redo MAIN;
}
/^theme_changed$/ and redo MAIN;
- unless (/^already displayed/ || /^ask_from_list cancel/) {
+ unless (/^already displayed/) {
eval { $o->errorInStep($_) };
$@ and next;
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 260ee774a..6b634cbf4 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -198,7 +198,7 @@ sub selectKeyboard {
#------------------------------------------------------------------------------
sub selectInstallClass1 {
my ($o, $verif, $l, $def, $l2, $def2) = @_;
- $verif->($o->ask_from_list(_("Install Class"), _("Which installation class do you want?"), $l, $def));
+ $verif->($o->ask_from_list(_("Install Class"), _("Which installation class do you want?"), $l, $def) || die 'already displayed');
$::live ? 'Update' : $o->ask_from_list_(_("Install/Update"), _("Is this an install or an update?"), $l2, $def2);
}
@@ -244,7 +244,7 @@ sub selectMouse {
$o->ask_from_listf(_("Mouse Port"),
_("Please choose on which serial port your mouse is connected to."),
\&mouse::serial_port2text,
- [ mouse::serial_ports ]);
+ [ mouse::serial_ports ]) or return;
}
any::setup_thiskind($o, 'usb', !$::expert, 0, $o->{pcmcia}) if $o->{mouse}{device} eq "usbmouse";
@@ -755,11 +755,12 @@ sub configurePrinter {
$::expert or $printer->{mode} ||= 'CUPS';
if ($::expert || !$printer->{mode}) {
$o->set_help('configurePrinterSystem');
- $printer->{mode} = $o->ask_from_list_([''], _("Which printing system do you want to use?"),
- [ 'CUPS', 'lpr', __("None") ],
- );
- $printer->{want} = $printer->{mode} ne 'None';
- $printer->{want} or $printer->{mode} = undef, return;
+ $o->ask_from_entries_refH_powered(
+ {
+ messages => _("Which printing system do you want to use?"),
+ }, [ { val => \$printer->{mode}, list => [ 'CUPS', 'lpr' ] } ]
+ ) or $printer->{mode} = undef, $printer->{want} = undef, return;
+ $printer->{want} = 1;
$o->set_help('configurePrinter');
}
@@ -874,12 +875,11 @@ failures. Would you like to create a bootdisk for your system?")),
} else {
@l or die _("Sorry, no floppy drive available");
- $o->{mkbootdisk} = $o->ask_from_listf('',
- _("Choose the floppy drive you want to use to make the bootdisk"),
- sub { $l{$_[0]} || $_[0] },
- [ @l, "Skip" ],
- $o->{mkbootdisk});
- return $o->{mkbootdisk} = '' if $o->{mkbootdisk} eq 'Skip';
+ $o->ask_from_entries_refH_powered(
+ {
+ messages => _("Choose the floppy drive you want to use to make the bootdisk"),
+ }, [ { val => \$o->{mkbootdisk}, list => \@l, format => sub { $l{$_[0]} || $_[0] } } ]
+ ) or return;
}
$o->ask_warn('', _("Insert a floppy in drive %s", $l{$o->{mkbootdisk}} || $o->{mkbootdisk}));
}
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 928c00c91..1d4dd0c68 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -98,7 +98,12 @@ sub ask_yesorno {
sub ask_okcancel {
my ($o, $title, $message, $def, $help) = @_;
- ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Ok" : "Cancel", $help) eq "Ok";
+
+ if ($::isWizard) {
+ $o->ask_from_entries_refH({ title => $title, messages => $message, focus_cancel => !$def });
+ } else {
+ ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Ok" : "Cancel", $help) eq "Ok";
+ }
}
sub ask_from_list {
@@ -131,8 +136,7 @@ sub ask_from_listf_no_check {
if_($l->[1], cancel => may_apply($f, $l->[1]), focus_cancel => $def eq $l->[1]) }, []
) ? $l->[0] : $l->[1];
} else {
- ask_from_entries_refH($o, $title, $message, [ { val => \$def, type => 'list', list => $l, help => $help, format => $f } ]) or die 'ask_from_list cancel';
- $def;
+ ask_from_entries_refH($o, $title, $message, [ { val => \$def, type => 'list', list => $l, help => $help, format => $f } ]) && $def;
}
}
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm
index 69140aad9..8cc04ac79 100644
--- a/perl-install/interactive_gtk.pm
+++ b/perl-install/interactive_gtk.pm
@@ -28,6 +28,10 @@ sub exit {
c::_exit($_[0]) #- workaround
}
+sub ask_warn {
+ local $my_gtk::pop_it = 1;
+ &interactive::ask_warn;
+}
sub create_clist {
my ($e, $may_go_to_next, $changed) = @_;
my (@widgets, $curr);
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 24549d7d7..3df0bc18a 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -43,7 +43,7 @@ sub new {
$o->{rwindow}->set_position('center_always') if $::isStandalone;
$o->{rwindow}->set_modal(1) if $my_gtk::grab || $o->{grab};
- if ($::isWizard) {
+ if ($::isWizard && !$my_gtk::pop_it) {
my $rc = "/etc/gtk/wizard.rc";
-r $rc or $rc = dirname(__FILE__) . "/wizard.rc";
Gtk::Rc->parse($rc);
@@ -288,12 +288,12 @@ sub create_okcancel {
my ($w, $ok, $cancel, $spread, @other) = @_;
my $one = ($ok xor $cancel);
$spread ||= $::isWizard ? "end" : "spread";
- $ok ||= _("Ok");
- $::isWizard and $ok = _("Next ->");
+ $ok ||= $::isWizard ? _("Next ->") : _("Ok");
+ $cancel ||= $::isWizard ? _("Previous") : _("Cancel");
my $b1 = gtksignal_connect($w->{ok} = new Gtk::Button($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk->main_quit });
- my $b2 = !$one && gtksignal_connect($w->{cancel} = new Gtk::Button($cancel || _("Cancel")), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk->main_quit });
- $::isWizard and my $b3 = gtksignal_connect($w->{previous} = new Gtk::Button(_("<- Previous")), clicked => $w->{previous_clicked} || sub { log::l("default previous_clicked"); $w->{retval} = -1; Gtk->main_quit });
- my @l = grep { $_ } $::isWizard ? ($b2, $b3, $b1): ($b1, $b2);
+ my $b2 = !$one && gtksignal_connect($w->{cancel} = new Gtk::Button($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk->main_quit });
+ $::isWizard and gtksignal_connect($w->{wizcancel} = new Gtk::Button(_("Cancel")), clicked => sub { die 'wizcancel' });
+ my @l = grep { $_ } $::isWizard ? ($b2, $w->{wizcancel}, $b1): ($b1, $b2);
push @l, map { gtksignal_connect(new Gtk::Button($_->[0]), clicked => $_->[1]) } @other;
$_->can_default($::isWizard) foreach @l;
@@ -375,7 +375,7 @@ sub create_packtable($@) {
ref $_ or $_ = new Gtk::Label($_);
$j != $#$l ?
$w->attach($_, $j, $j + 1, $i, $i + 1, 'fill', 'fill', 5, 0) :
- $w->attach($_, $j, $j + 1, $i, $i + 1, 1|4, ref($_) eq 'Gtk::ScrolledWindow' ? 1|4 : 0, 0, 0);
+ $w->attach($_, $j, $j + 1, $i, $i + 1, { 'fill', 'expand' }, ref($_) eq 'Gtk::ScrolledWindow' ? { 'fill', 'expand' } : 0, 0, 0);
$_->show;
}
} @$l;
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index 37560ecde..f9f42127b 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -235,15 +235,13 @@ sub setup_gsdriver_lpr($$$;$) {
do {
$printer->{DBENTRY} ||= $printer::thedb_gsdriver{$printer->{GSDRIVER}}{ENTRY};
- eval { $printer->{DBENTRY} = $printer::descr_to_db{
+ $printer->{DBENTRY} = $printer::descr_to_db{
$in->ask_from_list_(_("Configure Printer"),
_("What type of printer do you have?"),
[ @printer::entry_db_description ],
$printer::db_to_descr{$printer->{DBENTRY}},
- { %printer::descr_to_help })
- };
- }; $@ =~ /^ask_from_list cancel/ and return;
-
+ { %printer::descr_to_help }) || return
+ };
my %db_entry = %{$printer::thedb{$printer->{DBENTRY}}};
#- specific printer drivers to install.
@@ -300,7 +298,7 @@ sub setup_gsdriver_lpr($$$;$) {
printer::configure_queue($printer);
$printer->{complete} = 0;
- $action = $in->ask_from_listf('', _("Do you want to test printing?"), sub { $action{$_[0]} }, \@action, 'done');
+ $action = $in->ask_from_listf('', _("Do you want to test printing?"), sub { $action{$_[0]} }, \@action, 'done') or return;
my @testpages;
push @testpages, "/usr/lib/rhs/rhs-printfilters/testpage.asc"
@@ -342,10 +340,14 @@ sub main($$$;$) {
$queue = $printer->{want} || $in->ask_yesorno(_("Printer"),
_("Would you like to configure a printer?"), 0) ? 'lp' : 'Done';
} else {
- $queue = $in->ask_from_list_([''],
+ $in->ask_from_entries_refH_powered(,
+ {
+ messages =>
_("Here are the following print queues.
You can add some more or change the existing ones."),
- [ (sort keys %{$printer->{configured} || {}}), __("Add"), __("Done") ],
+ ok => '',
+ }, [ { val => \$queue, format => \&translate, list => [ (sort keys %{$printer->{configured} || {}}), __("Add"), __("Done") ] } ]
+ );
);
if ($queue eq 'Add') {
my %queues; @queues{map { split '\|', $_ } keys %{$printer->{configured}}} = ();
@@ -376,7 +378,7 @@ You can add some more or change the existing ones."),
_("How is the printer connected?"),
[ printer::printer_type($printer) ],
$printer->{str_type},
- );
+ ) or return;
$printer->{TYPE} = $printer::printer_type{$printer->{str_type}};
if ($printer->{TYPE} eq 'REMOTE') {
$printer->{str_type} = $printer::printer_type_inv{CUPS};
@@ -386,7 +388,7 @@ any printer here; printers will be automatically detected.
In case of doubt, select \"Remote CUPS server\"."),
[ @printer::printer_type_inv{qw(CUPS LPD SOCKET)} ],
$printer->{str_type},
- );
+ ) or return;
$printer->{TYPE} = $printer::printer_type{$printer->{str_type}};
}
if ($printer->{TYPE} eq 'CUPS') {
@@ -455,7 +457,7 @@ how is the printer connected?") }, [
_("How is the printer connected?"),
[ printer::printer_type($printer) ],
$printer->{str_type},
- );
+ ) or return;
} else {
$in->set_help('configurePrinterLPR') if $::isInstall;
$in->ask_from_entries_refH_powered(
diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake
index 6a0b86d86..6e89d353e 100755
--- a/perl-install/standalone/keyboarddrake
+++ b/perl-install/standalone/keyboarddrake
@@ -28,7 +28,7 @@ $keyboard ||= $in->ask_from_listf_(_("Keyboard"),
_("Please, choose your keyboard layout."),
\&keyboard::keyboard2text,
[ keyboard::keyboards() ],
- keyboard::read());
+ keyboard::read()) or $in->exit(0);
keyboard::keyboard2text($keyboard) or die "bad keyboard $keyboard\n";
@@ -61,6 +61,10 @@ substInFile {
keyboard::write('', $keyboard, $isNotDelete);
-$::isEmbedded ? kill(USR1, $::CCPID) : $in->exit(0);
-$keyboard='';
-goto begin;
+if ($::isEmbedded) {
+ kill(USR1, $::CCPID);
+ $keyboard = '';
+ goto begin;
+} else {
+ $in->exit(0);
+}
diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake
index aff16a1b6..ebb332f89 100755
--- a/perl-install/standalone/mousedrake
+++ b/perl-install/standalone/mousedrake
@@ -42,7 +42,7 @@ $o->{mouse}{device} =
$o->ask_from_listf(_("Mouse Port"),
_("Please choose on which serial port your mouse is connected to."),
\&mouse::serial_port2text,
- [ mouse::serial_ports ]) if $mouse->{type} eq 'serial';
+ [ mouse::serial_ports ]) || goto begin if $mouse->{type} eq 'serial';
dumpValue(\$mouse);
mouse::write_conf($mouse);