File: libglide3.config

package info (click to toggle)
glide 2002.04.10-18
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,712 kB
  • ctags: 24
  • sloc: makefile: 255; perl: 168; sh: 54
file content (91 lines) | stat: -rw-r--r-- 1,917 bytes parent folder | download | duplicates (6)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/perl -w
# Copyright (C) 2000  Zephaniah E. Hull.
# This code is under the GNU GPL, see /usr/share/common-licenses/GPL.

use strict;
use Debconf::Client::ConfModule ':all';

main();

my (%types);
BEGIN {
    %types = (
	"Voodoo Banshee"	=> "h3",
	"Voodoo Banshee [Velocity 100]" => "h3",
	"Voodoo 3"		=> "h3",
	"Voodoo 4"		=> "h5",
	"Voodoo 4 / Voodoo 5"	=> "h5",
	"Voodoo 5"		=> "h5",
    );
}

sub main {
    my (@cards, $driver);
    version('2.0');
    title('glide3 configuration');

    @cards = get_devices();
    if ($#cards == -1) {
	my ($choice);
	input('low', 'libglide3/no_card');
	go();
	$choice = get('libglide3/no_card');
	if ($choice eq "true") {
	    input('low', 'libglide3/driver');
	    go();
	} else {
	    set('libglide3/driver', 'h5');
	    go();
	}
    } elsif ($#cards == 0) {
	set('libglide3/driver', ${$cards[0]}{'Driver'});
	go();
    } else {
	my (%card, $card, $choices, %choices, $choice, $tmp);

	for $card (@cards) {
	    %card = %$card;
	    if (defined($card{'SVendor'})) {
		$tmp = sprintf("%s %s (%s)", $card{'SVendor'},
			       $card{'SDevice'}, $card{'Device'});
	    } else {
		$tmp = sprintf("3Dfx %s", $card{'Device'});
	    }
	    $tmp =~ s/,//g;

	    $choices{$tmp} = $card{'Driver'};
	}

	$choices = join(', ', keys(%choices));
	subst('libglide3/card', 'choices', $choices);
	input('high', 'libglide3/card');
	go();
	$choice = get('libglide3/card');

	$tmp = $choices{$choice};
	set('libglide3/driver', $tmp);
    }

#    stop();
}

sub get_devices {
    my ($raw, $dev, $line, $tmp, @cards);
    $raw = `lspci -vm`;

    foreach $dev (split(/\n\n/, $raw)) {
	my (%info);
	foreach $line (split(/\n/, $dev)) {
	    if($line =~ /^(Class|Vendor|Device|SVendor|SDevice|Rev):\s+(.*)$/) {
		$info{$1} = $2;
	    }
	}
	if (defined($types{$info{'Device'}})) {
	    $info{"Driver"} = $types{$info{"Device"}};
	    push(@cards, \%info);
	}
    }

    return @cards;
}