From 2707019e8d43f78fd3913c0ca5f2d79d2fa20cc1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 10 Jan 2003 13:38:50 +0000 Subject: simplify and factorize (now works on 1.upgrade 2.install 3.install + change existing config) --- perl-install/Xconfig/main.pm | 19 +++++++++++++++++++ perl-install/install_steps.pm | 6 +++--- perl-install/install_steps_interactive.pm | 17 ++++++----------- perl-install/standalone/XFdrake | 12 +----------- 4 files changed, 29 insertions(+), 25 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index 0e9f335c5..546ae6e64 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -140,6 +140,25 @@ sub configure_chooser { 'config_changed'; } +sub configure_everything_or_configure_chooser { + my ($in, $options, $auto, $keyboard, $mouse) = @_; + my $raw_X = Xconfig::xfree->read; + my $default = Xconfig::default::configure($keyboard, $mouse); + my $has_conf = @{$raw_X->{xfree3}} || @{$raw_X->{xfree4}}; + $raw_X->{xfree3} = $default->{xfree3} if !@{$raw_X->{xfree3}}; + $raw_X->{xfree4} = $default->{xfree4} if !@{$raw_X->{xfree4}}; + + return $raw_X if $has_conf && $auto; + + if ($has_conf) { + Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options) or return; + } else { + Xconfig::main::configure_everything($in, $raw_X, $in->do_pkgs, $auto, $options) or return; + } + $raw_X; +} + + sub may_write { my ($in, $raw_X, $X, $ok) = @_; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index eb51551b2..5d7314166 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -898,9 +898,6 @@ sub setupBootloader { sub configureXBefore { my ($o) = @_; - require Xconfig::default; - $o->{raw_X} = Xconfig::default::configure($o->{keyboard}, $o->{mouse}); - #- keep this here if the package has to be updated. $o->pkg_install("XFree86"); } @@ -908,6 +905,9 @@ sub configureX { my ($o) = @_; configureXBefore($o); + require Xconfig::default; + $o->{raw_X} = Xconfig::default::configure($o->{keyboard}, $o->{mouse}); + require Xconfig::main; Xconfig::main::configure_everything_auto_install($o->{raw_X}, $o->do_pkgs, $o->{X}, { allowFB => $o->{allowFB}, diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index d4f70adc2..dd26fce10 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -1111,22 +1111,17 @@ sub miscellaneous { sub configureX { my ($o, $expert) = @_; + install_steps::configureXBefore($o); + symlink "$o->{prefix}/etc/gtk", "/etc/gtk"; + my $options = { allowFB => $o->{allowFB}, allowNVIDIA_rpms => install_any::allowNVIDIA_rpms($o->{packages}), }; - if ($o->{raw_X}) { - Xconfig::main::configure_chooser($o, $o->{raw_X}, $o->do_pkgs, $options); - } else { - install_steps::configureXBefore($o); - symlink "$o->{prefix}/etc/gtk", "/etc/gtk"; - require Xconfig::main; - if (Xconfig::main::configure_everything($o, $o->{raw_X}, $o->do_pkgs, !$expert, $options)) { - install_steps::configureXAfter($o); - } else { - $o->{raw_X} = undef; - } + require Xconfig::main; + if ($o->{raw_X} = Xconfig::main::configure_everything_or_configure_chooser($o, $options, !$expert, $o->{keyboard}, $o->{mouse})) { + install_steps::configureXAfter($o); } } diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake index 9ce09160b..44f0e28d2 100755 --- a/perl-install/standalone/XFdrake +++ b/perl-install/standalone/XFdrake @@ -48,17 +48,7 @@ begin: if ($configure_this eq 'everything') { check_XFree($in); - my $raw_X = Xconfig::xfree->read; - my $default = Xconfig::default::configure(); - my $has_conf = @{$raw_X->{xfree3}} || @{$raw_X->{xfree4}}; - $raw_X->{xfree3} = $default->{xfree3} if !@{$raw_X->{xfree3}}; - $raw_X->{xfree4} = $default->{xfree4} if !@{$raw_X->{xfree4}}; - - if ($has_conf) { - Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options); - } else { - Xconfig::main::configure_everything($in, $raw_X, $in->do_pkgs, $::auto, $options); - } + Xconfig::main::configure_everything_or_configure_chooser($in, $options, $::auto); } elsif ($configure_this eq 'auto_install') { Xconfig::main::configure_everything_auto_install(Xconfig::default::configure(), $in->do_pkgs, {}, $options); } elsif ($configure_this eq 'monitor') { -- cgit v1.2.1