aboutsummaryrefslogtreecommitdiffstats
path: root/create_modinfo.pl
blob: b3bf8458ef7d44021191d0dfc0eae5264a08214d (plain)
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
#!/usr/bin/perl -w

use File::Spec;

for $dir (<*>) {
    next if $dir eq "create_modinfo.pl";

    my @files = glob("$dir/*");

    my $modfile = "$dir/modinfo.txt";

    open MOD, ">$modfile" or die "Couldn't write $modfile\n ($!)";

    my $name = uc $dir;
    my $macro = uc $dir;

    print MOD "realname \"$name\"\n\n";

    print MOD "define $macro\n\n";

    print MOD "load_on auto\n\n";

    print MOD "<add>\n";

    for my $fsname (@files) {
        my (undef, undef, $file) = File::Spec->splitpath($fsname);
        print MOD "$file\n";
    }

    print MOD "</add>\n";

    close MOD;

    #print $dir, " - ", join(' ', glob("$dir/*")), "\n";
}