summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-01-16 15:50:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-01-16 15:50:21 +0000
commitf2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd (patch)
treea535c0152d8d465371531745c3c5581514509234
parent4babc8a0ffdbb27b3b962505f7e1aa7a943c15c3 (diff)
downloaddrakx-f2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd.tar
drakx-f2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd.tar.gz
drakx-f2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd.tar.bz2
drakx-f2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd.tar.xz
drakx-f2e596dd02dfdb0bbe2b5b25dcc58ac7f9c027cd.zip
when reading an existing X config file, ensure it is not too bad, otherwise propose to start from scratch
(bugzilla #8548)
-rw-r--r--perl-install/Xconfig/main.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
index a3398c80f..e53ce0caa 100644
--- a/perl-install/Xconfig/main.pm
+++ b/perl-install/Xconfig/main.pm
@@ -160,7 +160,7 @@ sub configure_everything_or_configure_chooser {
my ($in, $options, $auto, $o_keyboard, $o_mouse) = @_;
my $raw_X = eval { Xconfig::xfree->read };
- if (!$raw_X) {
+ if (!$raw_X || !is_valid($raw_X)) {
log::l("ERROR: bad X config file $@");
$in->ask_okcancel('',
N("Your Xorg configuration file is broken, we will ignore it.")) or return;
@@ -215,6 +215,16 @@ sub export_to_install_X {
$::o->{X}{Xinerama} = 1 if $X->{card}{Xinerama};
}
+sub is_valid {
+ my ($raw_X) = @_;
+
+ my %sections = map {
+ my @l = $raw_X->get_Sections($_) or return;
+ $_ => \@l;
+ } qw(Files InputDevice Monitor Device Screen ServerLayout);
+
+ $sections{Files}[0]{FontPath};
+}
#- most usefull XFree86-4.0.1 server options. Default values is the first ones.
our @options_serverflags = (