Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 42 lines (31 sloc) 0.898 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use File::Copy;

# http://github.com/dbbolton/

# Options:
my $dir = '/usr/lib/xorg/modules/extensions';
my $backup_ext = '.orig';
my $target = 'libglx.so';

my $choice;

# Find all potential Nvidia GLX plugin files:
my @nv_glx_files;
for (<$dir/libglx*>) {
    if (/libglx\.so\.([\d\.])+$/) {
        push @nv_glx_files, $_;
        s/libglx\.so\.//;
        print "Found version '" . basename $_ . "'\n";
    }
}

# The globbed array should be lexographical, but just to be sure:
my @sorted = sort @nv_glx_files;

# Pick the latest version.
# (If you want to set a static version, set $choice manually.)
$choice = $sorted[-1];
print "\nUsing '$choice' as libglx.so\n";

# Now create the proper link:
move "$dir/$target", "$dir/libglx.so$backup_ext";
symlink "$choice", "$dir/$target";

print "\nFinished.\n";

exit 0;

Something went wrong with that request. Please try again.