#!/usr/bin/perl -w ######### # install.pl - install and initialize MarlboroClassSchedule.cgi # $Id: install.pl,v 1.2 2002/04/12 07:45:19 msie Exp $ ############## my $scriptname = "MarlboroClassSchedule.cgi"; my $testname = "test.pl"; my $defaultdir = "deploy"; print " -- Installation script for $scriptname -- \n"; # Specify where the script should be installed. print "In what cgi enabled directory should I install the script? [$defaultdir] "; chomp(my $where = <>); $where = $where || $defaultdir; $where .= "/" unless $where =~ m{/$}; die "I can't write in that directory; error " unless -d $where and -w $where; # Copy the script to that location, and make sure its privileges are OK. system("cp", $scriptname, $where) == 0 or die "OOPS - couldn't copy script to destination; error "; # Copy the test script, too. system("cp", $testname, $where) == 0 or die "OOPS - couldn't copy test.pl to destination; error "; # Go to that directory, and make sure they're executable. chdir $where; chmod 0755, $scriptname; chmod 0755, $testname; # load the package and let it initialize itself. require "MarlboroClassSchedule.cgi"; MarlboroClassSchedule::initData(); # Run the tests unless the user answers "no" print "Run the live tests? [y] "; chomp(my $answer = <>); system("./$testname") unless $answer =~ /^n/i; print "Done installation.\n";