File: cgi_install.pl

package info (click to toggle)
gbrowse 2.54%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,724 kB
  • ctags: 4,370
  • sloc: perl: 48,499; sh: 164; sql: 62; makefile: 39; ansic: 27
file content (44 lines) | stat: -rwxr-xr-x 1,009 bytes parent folder | download | duplicates (7)
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
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
use strict;
use File::Copy;
use Bio::Root::IO;
use File::Path 'mkpath';
use Cwd;
use FindBin '$Bin';

my $origdir = cwd;
my $homedir = "$Bin/..";

chdir $homedir or die "couldn't cd to $homedir: $!\n";

foreach (@ARGV) {
  $_ =~ s/^\"(.*)\"$/$1/;
}

my %options = map {split /=/} @ARGV;
my $cgi_target = $options{CGIBIN};

print "Installing gbrowse CGI scripts...\n";

if (! (-e $cgi_target) ) {
    mkpath($cgi_target,0,0777) or die "unable to create $cgi_target directory\n";
}

my $cgidir = "cgi-bin";
chdir $cgidir;
foreach (glob('*')) {
  next if /README/;
  next if /CVS/;
  next if /^[.\#]/;
  next if /~$/;
  next if /\.PLS$/;
  next unless (-f $_);
  my $installfile = Bio::Root::IO->catfile($cgi_target, $_);
  warn "copying $_ to $installfile\n";
  copy($_, $installfile ) or die "unable to copy to $installfile\n";
  my $mode = 0755;
  chmod $mode, $installfile
    or die "unable to make $installfile world executable\n";
}

chdir $origdir or die "couldn't cd to $origdir: $!\n";