summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/service_harddrake
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-07-04 16:41:03 +0000
committerThierry Vignaud <tv@mandriva.org>2007-07-04 16:41:03 +0000
commitaf31c99dbd17dbb3d359122adde00444582db8af (patch)
treef4bd91ccc8b8d5fea75ab57a21c96df27cb2dc36 /perl-install/standalone/service_harddrake
parent44e49c3c52592b38faf044ac963124ef145f060f (diff)
downloaddrakx-af31c99dbd17dbb3d359122adde00444582db8af.tar
drakx-af31c99dbd17dbb3d359122adde00444582db8af.tar.gz
drakx-af31c99dbd17dbb3d359122adde00444582db8af.tar.bz2
drakx-af31c99dbd17dbb3d359122adde00444582db8af.tar.xz
drakx-af31c99dbd17dbb3d359122adde00444582db8af.zip
factorize code handling switch for both ati & nvidia
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-xperl-install/standalone/service_harddrake41
1 files changed, 18 insertions, 23 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 1a950ee21..3f3f4edee 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -47,29 +47,24 @@ if (!exists $previous_kernel_config{IS_LAPTOP} || $force || $isLaptop != text2bo
harddrake::autoconf::laptop($isLaptop);
}
-if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) {
- if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } qw(NVdriver nvidia.o nvidia.o.gz), map { $_, "$_.gz" } qw(nvidia.ko nvidia71xx.ko nvidia96xx.ko nvidia97xx.ko)) {
- # do not automatically switch from nv to nvidia (in order to handle
- # cases where nvidia module crashes the system):
- #
- # substInFile {
- # log::explanations("switch XFree86 driver from nv to nvidia") if /Driver "nv"/;
- # s!Driver "nv.*"!Driver "nvidia"!g;
- # s!#*( Load.*glx)!\1!g;
- # } $_ foreach "/etc/X11/XF86Config-4", "/etc/X11/XF86Config";
- } else {
- my $done;
- substInFile { $done ||= s!Driver "nv.*"!Driver "nv"!g } '/etc/X11/xorg.conf';
- if ($done) {
- log::explanations("switch X.org driver from nvidia to nv");
- require Xconfig::card;
- Xconfig::card::libgl_config_and_more({ Driver => 'nv' });
- }
+my @cards = (
+ {
+ ldetect_driver_regexp => 'Card:NVIDIA',
+ xorg_driver_regexp => 'nv.+',
+ module_names => [ qw(NVdriver nvidia.o nvidia.ko nvidia71xx.ko nvidia96xx.ko nvidia97xx.ko) ]
+ },
+ {
+ ldetect_driver_regexp => 'Card:ATI Radeon',
+ xorg_driver_regexp => 'fglrx',
+ module_names => [ qw(fglrx.ko) ]
}
-}
+);
+
+foreach my $card (@cards) {
+ next if !find { $_->{driver} =~ /$card->{ldetect_driver_regexp}/ } detect_devices::probeall();
+ if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") }
+ map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } map { $_, "$_.gz" } @{$card->{module_names}}) {
-if (find { $_->{driver} =~ /ATI Radeon/ } detect_devices::probeall()) {
- if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } map { $_, "$_.gz" } qw(fglrx.ko)) {
# do not automatically switch from nv to nvidia (in order to handle
# cases where nvidia module crashes the system):
#
@@ -83,9 +78,9 @@ if (find { $_->{driver} =~ /ATI Radeon/ } detect_devices::probeall()) {
my @cards = Xconfig::card::probe();
my $driver = $cards[0]{Driver};
my $done;
- substInFile { $done ||= s!Driver "fglrx"!Driver "$driver"!g } '/etc/X11/xorg.conf';
+ substInFile { $done = $1 if s!Driver "($card->{xorg_driver_regexp})"!Driver "$driver"!g } '/etc/X11/xorg.conf';
if ($done) {
- log::explanations("switch X.org driver from fglrx to $driver");
+ log::explanations("switch X.org driver from $done to $driver");
Xconfig::card::libgl_config_and_more({ Driver => $driver });
}
}