diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-07-04 16:19:00 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-07-04 16:19:00 +0000 |
commit | c5e1e086ff457ce44a4960ba72b7917f106e583e (patch) | |
tree | 3cc7785883b6b7697939fe6f74065a3ac03c92d5 | |
parent | 42dbd7c86b1d77ce8dc182b79dc681f672a7a56e (diff) | |
download | drakx-backup-do-not-use-c5e1e086ff457ce44a4960ba72b7917f106e583e.tar drakx-backup-do-not-use-c5e1e086ff457ce44a4960ba72b7917f106e583e.tar.gz drakx-backup-do-not-use-c5e1e086ff457ce44a4960ba72b7917f106e583e.tar.bz2 drakx-backup-do-not-use-c5e1e086ff457ce44a4960ba72b7917f106e583e.tar.xz drakx-backup-do-not-use-c5e1e086ff457ce44a4960ba72b7917f106e583e.zip |
more consise code; only one regexp
-rwxr-xr-x | perl-install/standalone/service_harddrake | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index 1280ccd83..a17f9484a 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -59,16 +59,12 @@ if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) { # } $_ foreach "/etc/X11/XF86Config-4", "/etc/X11/XF86Config"; } else { my $done; - substInFile { - if (/Driver "nv.+"/) { - $done = 1; - log::explanations("switch X.org driver from nvidia to nv"); - s!Driver "nv.+"!Driver "nv"!g; - } - } '/etc/X11/xorg.conf'; - - require Xconfig::card; - Xconfig::card::libgl_config_and_more({ Driver => 'nv' }) if $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' }); + } } } @@ -87,17 +83,12 @@ if (find { $_->{driver} =~ /ATI Radeon/ } detect_devices::probeall()) { my @cards = Xconfig::card::probe(); my $driver = $cards[0]{Driver}; my $done; - substInFile { - if (/Driver "fglrx"/) { - $done = 1; - log::explanations("switch X.org driver from fglrx to ati"); - s!Driver "fglrx"!Driver "$driver"!g; - } - s!Driver "fglrx"!Driver "$driver"!g; - } '/etc/X11/xorg.conf'; - - require Xconfig::card; - Xconfig::card::libgl_config_and_more({ Driver => $driver }); + substInFile { $done ||= s!Driver "fglrx"!Driver "$driver"!g } '/etc/X11/xorg.conf'; + if ($done) { + log::explanations("switch X.org driver from fglrx to ati"); + require Xconfig::card; + Xconfig::card::libgl_config_and_more({ Driver => $driver }); + } } } |