diff options
author | James A. Treacy <treacy> | 1998-10-21 05:06:38 +0000 |
---|---|---|
committer | James A. Treacy <treacy> | 1998-10-21 05:06:38 +0000 |
commit | 7560e90b67a24266d16a3191042192715d56a257 (patch) | |
tree | c7b7087dba125647056c5a3f0da70733cda4ae2d /make_links.pl | |
parent | 6d29b3382d10c63d9825ff882376200c0f175969 (diff) |
added to CVS
CVS version numbers
make_links.pl: INITIAL -> 1.1
Diffstat (limited to 'make_links.pl')
-rwxr-xr-x | make_links.pl | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/make_links.pl b/make_links.pl new file mode 100755 index 00000000000..d94a41fe2dd --- /dev/null +++ b/make_links.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w + +# This script creates any missing soft links in the Debian html +# directory on master. These links are necessary so that under content +# negotiation there is a default language. +# Translators shouldn't have any need of this. + +# For every <file>.html.en there needs to be a <file>.html -> <file>.html.en + +$top_dir = "/debian2/web/debian.org"; + +check_directory($top_dir); + +sub check_directory() { + my ($curdir) = @_; + my (@dir_list, @fil_list, @parts, $lang, $html, $name); + + opendir(DIR, $curdir) or die "can't opendir $curdir: $!"; + @dir_list = grep { -d "$curdir/$_" and $_ !~ /^..?$/ } readdir(DIR); + rewinddir DIR; + @fil_list = grep { -f "$curdir/$_" } readdir(DIR); + foreach (@dir_list) { + check_directory("$curdir/$_"); + } + foreach $file (@fil_list) { + @parts = split('\.', $file); + $lang = pop @parts; + $html = pop @parts; + $name = join('.', @parts); + if (defined($html) and $lang =~ /^en$/ and $html eq "html") { + if ( ! -e "$curdir/$name.html") { + symlink("$file", "$curdir/$name.html"); + print " creating symlink to $file\n"; + } + } + } +} |