mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11560 e03df62e-2008-0410-955e-edbf42e46eb7
30 lines
684 B
Perl
Executable File
30 lines
684 B
Perl
Executable File
#!/usr/bin/perl
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $mode = shift;
|
|
my %installed;
|
|
|
|
for my $dir (qw(src src/modules)) {
|
|
opendir(DIRHANDLE, $dir);
|
|
for my $file (sort readdir(DIRHANDLE)) {
|
|
next unless $file =~ /\.cpp$/;
|
|
open CPP, '<', "$dir/$file" or die "Can't open $dir/$file to scan it: $!";
|
|
while (<CPP>) {
|
|
if (/\/\* \$CopyInstall: (\S+) (\S+) \*\//i) {
|
|
my($ifile, $idir) = ($1,$2);
|
|
next if exists $installed{$1.' '.$2};
|
|
$installed{$1.' '.$2}++;
|
|
$idir =~ s/\$\(([^)]+)\)/$ENV{$1}/eg;
|
|
if ($mode eq 'install') {
|
|
system "install $ifile $idir";
|
|
} else {
|
|
$ifile =~ s/.*\///g;
|
|
system "rm $idir/$ifile";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
closedir(DIRHANDLE);
|
|
}
|