From 12540853e8b4439f46b10d7a9ed65faddfb3ab62 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 16 Sep 2005 14:05:53 +0000 Subject: instead of symlinking, comment the content of the ld.so.conf.d/*.conf --- perl-install/Xconfig/card.pm | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm index 23e1d1e18..2151406d3 100644 --- a/perl-install/Xconfig/card.pm +++ b/perl-install/Xconfig/card.pm @@ -459,27 +459,31 @@ sub set_glx_restrictions { sub libgl_config { my ($Driver) = @_; - my $dir = "$::prefix/etc/ld.so.conf.d/"; + my $dir = "$::prefix/etc/ld.so.conf.d"; + my $comment = '# commented-by-DrakX '; my %driver_to_libgl_config = ( - nvidia => '.nvidia.conf', - fglrx => '.ati.conf', + nvidia => 'nvidia.conf', + fglrx => 'ati.conf', ); my $need_to_run_ldconfig; - my $link = "$dir/GL.conf"; - if (my $file = $driver_to_libgl_config{$Driver}) { - if (-e "$dir/$file" && readlink($link) ne $file) { - symlinkf($file, "$dir/GL.conf"); - $need_to_run_ldconfig = 1; - log::explanations("ldconfig will be run because the GL library was enabled"); - } - } elsif (-e $link) { - eval { rm_rf($link) }; - $need_to_run_ldconfig = 2; - log::explanations("ldconfig will be run because the GL library was disabled"); - + my $wanted = $driver_to_libgl_config{$Driver}; + foreach my $file (values %driver_to_libgl_config) { + substInFile { + my ($commented, $s) = /^($comment)?(.*)/; + if ($file eq $wanted) { + $_ = "$s\n"; + $need_to_run_ldconfig ||= $commented; + } else { + $_ = "$comment$s\n"; + $need_to_run_ldconfig ||= !$commented; + } + } "$dir/$file"; + } + if ($::isStandalone && $need_to_run_ldconfig) { + log::explanations("ldconfig will be run because the GL library was " . ($wanted ? 'enabled' : 'disabled')); + system("/sbin/ldconfig"); } - system("/sbin/ldconfig") if $::isStandalone && $need_to_run_ldconfig; } sub add_to_card__using_Cards { -- cgit v1.2.1