ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/install.unix
Revision: 43
Committed: 2003-01-22T22:12:34-08:00 (22 years, 5 months ago) by douglas
File size: 1049 byte(s)
Log Message:
Added version tag for templates and implemented it in the header and footer.
Added chmod for search.cgi to install.unix.
Updated version to 1.1rc2

File Contents

# Content
1 #!/usr/bin/perl
2 #
3 # Douglas Thrift's Search Engine Install Script
4 #
5 # Douglas Thrift
6 #
7
8 use strict;
9
10 my $path;
11 while (<STDIN>)
12 {
13 $path = $_;
14 chomp($path);
15 }
16
17 my $install = $path;
18 my $input = "search.cgi.unix";
19 my $output = "$install/http/search.cgi";
20
21 open(INPUT, "< $input") || die "$0: cannot open $input";
22 open(OUTPUT, "> $output") || die "$0: cannot open $output";
23
24 my $line;
25 while ($line = <INPUT>)
26 {
27 chomp($line);
28
29 if ($line eq "#!/usr/bin/perl")
30 {
31 my $perl = qx("which" "perl");
32
33 chomp($perl);
34
35 if ($perl ne "" && $line ne "#!$perl")
36 {
37 $line = "#!$perl";
38 }
39 }
40 elsif ($line =~ /my \$root = .+/)
41 {
42 my $root = $install;
43
44 my $begin = 0;
45 while ($begin < length($root))
46 {
47 my $space = index($root, " ", $begin);
48
49 last if ($space == -1);
50
51 $root = substr($root, 0, $space) . "\\ " . substr($root, $space +
52 1);
53
54 $begin = $space + 2;
55 }
56
57 if ($line ne "my \$root = \"$root\";")
58 {
59 $line = "my \$root = \"$root\";";
60 }
61 }
62
63 print OUTPUT "$line\n";
64 }
65
66 close(INPUT);
67 close(OUTPUT);
68
69 chmod(0755, $output);