File: make-links

package info (click to toggle)
doc-linux 2008.08-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 21,252 kB
  • ctags: 127
  • sloc: perl: 420; sh: 161; makefile: 147
file content (22 lines) | stat: -rw-r--r-- 597 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
#! /usr/bin/perl -w
use strict;

# Set up links to doc-linux or doc-linux-nonfree control files, as
# appropriate.

if (@ARGV < 1 or $ARGV[0] !~ /^doc-linux(?:-nonfree)?$/) {
    print STDERR "Usage: $0 <doc-linux/doc-linux-nonfree>\n";
    exit 1;
}

my $package = $ARGV[0];

opendir DEBIAN, 'debian' or die "Can't open debian directory: $!";
for my $file (readdir DEBIAN) {
    next unless $file =~ /^\Q$package\E\.(.*)/;
    my $target = "debian/$1";
    my $source = "debian/$file";
    unlink $target;
    link $source, $target or warn "Can't link $source to $target: $!";
}
closedir DEBIAN;