| 1 |
#!/usr/bin/perl -w
|
| 2 |
|
| 3 |
# This script creates any missing soft links in the Debian html directory
|
| 4 |
# on master. These links are necessary so that under content negotiation
|
| 5 |
# there is a default language. For every <file>.en.html there needs to be
|
| 6 |
# a <file>.html -> <file>.en.html
|
| 7 |
|
| 8 |
# Translators shouldn't have any need of this.
|
| 9 |
# Makefiles in webwml/english/ have already been set up to create these
|
| 10 |
# links while installing files, so there should be no need to run this.
|
| 11 |
|
| 12 |
$top_dir = "/debian2/web/debian.org";
|
| 13 |
|
| 14 |
check_directory($top_dir);
|
| 15 |
|
| 16 |
sub check_directory() {
|
| 17 |
my ($curdir) = @_;
|
| 18 |
my (@dir_list, @fil_list, @parts, $lang, $html, $name);
|
| 19 |
|
| 20 |
print "$curdir\n";
|
| 21 |
opendir(DIR, $curdir) or die "can't opendir $curdir: $!";
|
| 22 |
@dir_list = grep { -d "$curdir/$_" and $_ !~ /^..?$/ and ! -l "$curdir/$_" and
|
| 23 |
$_ ne "gnome" and $_ ne "OpenHardware" and $_ ne "OpenSource" and
|
| 24 |
$_ ne "berlin"} readdir(DIR);
|
| 25 |
rewinddir DIR;
|
| 26 |
@fil_list = grep { -f "$curdir/$_" } readdir(DIR);
|
| 27 |
foreach (@dir_list) {
|
| 28 |
check_directory("$curdir/$_");
|
| 29 |
}
|
| 30 |
foreach $file (@fil_list) {
|
| 31 |
@parts = split('\.', $file);
|
| 32 |
$html = pop @parts;
|
| 33 |
$lang = pop @parts;
|
| 34 |
$name = join('.', @parts);
|
| 35 |
if (defined($html) and $lang =~ /^en$/ and $html eq "html") {
|
| 36 |
if ( ! -e "$curdir/$name.html") {
|
| 37 |
print " creating symlink to $curdir/$file\n";
|
| 38 |
symlink("$file", "$curdir/$name.html");
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
| 42 |
}
|