Skip to content

Commit

Permalink
fixing for windows wierdness
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Cain committed Aug 25, 2003
1 parent 43f835b commit efd28a4
Show file tree
Hide file tree
Showing 3 changed files with 323 additions and 310 deletions.
60 changes: 32 additions & 28 deletions install_util/cgi_install.pl
@@ -1,28 +1,32 @@
#!/usr/bin/perl -w
use strict;
use File::Copy;
use Bio::Root::IO;

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

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

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

chdir 'cgi-bin';
foreach (glob('*')) {
next if /README/;
next if /CVS/;
next if /^[.\#]/;
next if /~$/;
next if /\.PLS$/;
my $installfile = Bio::Root::IO->catfile($cgi_target, $_);
warn "copying $_ to $installfile";
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";
}
#!/usr/bin/perl -w
use strict;
use File::Copy;
use Bio::Root::IO;

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

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

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

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

chdir 'cgi-bin';
foreach (glob('*')) {
next if /README/;
next if /CVS/;
next if /^[.\#]/;
next if /~$/;
next if /\.PLS$/;
my $installfile = Bio::Root::IO->catfile($cgi_target, $_);
warn "copying $_ to $installfile";
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";
}
162 changes: 83 additions & 79 deletions install_util/conf_install.pl
@@ -1,79 +1,83 @@
#!/usr/bin/perl -w
use strict;

#Perform installation of gbrowse apache configuration files

use File::Copy;
use Bio::Root::IO;

# get configuration stuff from command line
my %options = map {split /=/} @ARGV;
my $dir = "$options{CONF}/gbrowse.conf";

#start the installation...
print "Installing sample configuration files...\n";

if (! (-e $dir)) {
mkdir($dir,0777) or die "unable to make $dir directory\n";
}

opendir CONFDIR, "conf" or die "unable to opendir conf\n";
while (my $conffile = readdir(CONFDIR) ) {
my $localfile = Bio::Root::IO->catfile('conf', $conffile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($dir, $conffile);
copy_with_substitutions($localfile, $installfile)
or die "unable to copy to $installfile\n";
}
}
closedir CONFDIR;

my $plugindir = Bio::Root::IO->catfile($dir, "plugins");
if (! (-e $plugindir)) {
mkdir($plugindir,0777) or die "unable to mkdir $plugindir\n";
}


opendir PLUGINS, "conf/plugins" or die "unable to opendir ./conf/plugins\n";
while (my $pluginfile = readdir(PLUGINS) ) {
my $localfile = Bio::Root::IO->catfile('conf/plugins',$pluginfile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($plugindir, $pluginfile);
chmod (0666, $installfile);
copy($localfile, $installfile)
or die "$localfile unable to copy to $installfile : $!\n";
chmod (0444, $installfile);
}
}
closedir PLUGINS;

my $langdir = Bio::Root::IO->catfile($dir, 'languages');
if (! (-e $langdir)) {
mkdir($langdir,0777) or die "unable to mkdir $langdir\n";
}

opendir LANGS, "conf/languages" or die "unable to opendir ./conf/languages\n";
while (my $langfile = readdir(LANGS)) {
my $localfile = Bio::Root::IO->catfile("conf/languages", $langfile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($langdir, $langfile);
chmod (0666, $installfile);
copy($localfile, $installfile)
or die "unable to copy to $installfile\n";
chmod (0444, $installfile);
}
}
closedir LANGS;


sub copy_with_substitutions {
my ($localfile,$install_file) = @_;
open (IN,$localfile) or die "Couldn't open $localfile: $!";
open (OUT,">$install_file") or die "Couldn't open $install_file for writing: $!";
while (<IN>) {
s/\$(\w+)/$options{$1}||"\$$1"/eg;
print OUT;
}
close OUT;
close IN;
}
#!/usr/bin/perl -w
use strict;

#Perform installation of gbrowse apache configuration files

use File::Copy;
use Bio::Root::IO;

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

# get configuration stuff from command line
my %options = map {split /=/} @ARGV;
my $dir = "$options{CONF}/gbrowse.conf";

#start the installation...
print "Installing sample configuration files...\n";

if (! (-e $dir)) {
mkdir($dir,0777) or die "unable to make $dir directory\n";
}

opendir CONFDIR, "conf" or die "unable to opendir conf\n";
while (my $conffile = readdir(CONFDIR) ) {
my $localfile = Bio::Root::IO->catfile('conf', $conffile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($dir, $conffile);
copy_with_substitutions($localfile, $installfile)
or die "unable to copy to $installfile\n";
}
}
closedir CONFDIR;

my $plugindir = Bio::Root::IO->catfile($dir, "plugins");
if (! (-e $plugindir)) {
mkdir($plugindir,0777) or die "unable to mkdir $plugindir\n";
}


opendir PLUGINS, "conf/plugins" or die "unable to opendir ./conf/plugins\n";
while (my $pluginfile = readdir(PLUGINS) ) {
my $localfile = Bio::Root::IO->catfile('conf/plugins',$pluginfile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($plugindir, $pluginfile);
chmod (0666, $installfile);
copy($localfile, $installfile)
or die "$localfile unable to copy to $installfile : $!\n";
chmod (0444, $installfile);
}
}
closedir PLUGINS;

my $langdir = Bio::Root::IO->catfile($dir, 'languages');
if (! (-e $langdir)) {
mkdir($langdir,0777) or die "unable to mkdir $langdir\n";
}

opendir LANGS, "conf/languages" or die "unable to opendir ./conf/languages\n";
while (my $langfile = readdir(LANGS)) {
my $localfile = Bio::Root::IO->catfile("conf/languages", $langfile);
if (-f $localfile) {
my $installfile = Bio::Root::IO->catfile($langdir, $langfile);
chmod (0666, $installfile);
copy($localfile, $installfile)
or die "unable to copy to $installfile\n";
chmod (0444, $installfile);
}
}
closedir LANGS;


sub copy_with_substitutions {
my ($localfile,$install_file) = @_;
open (IN,$localfile) or die "Couldn't open $localfile: $!";
open (OUT,">$install_file") or die "Couldn't open $install_file for writing: $!";
while (<IN>) {
s/\$(\w+)/$options{$1}||"\$$1"/eg;
print OUT;
}
close OUT;
close IN;
}

0 comments on commit efd28a4

Please sign in to comment.