source: main/trunk/greenstone2/bin/script/full-buildcol.pl@ 24192

Last change on this file since 24192 was 24192, checked in by ak19, 13 years ago

Sam discovered that using dollar-Config{perlpath} in place of dollar-hat-X is the better way to obtain the path to the perl that is being used. We hope this will not be a relative path on the Mac as dollar-hat-x was on Professor Witten's Mac when we tried it there today.

  • Property svn:executable set to *
File size: 2.2 KB
RevLine 
[18470]1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# full-buildcol.pl -- runs buildcol.pl with -removeold option on
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 2009 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28
29# This program will "buildcol" (or re-"buildcol") a collection from scratch
30# Runs: buildcol.pl -removeold ...
31
[19409]32BEGIN {
33 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
34}
[18470]35
36use strict;
[24192]37use Config; # for getting the perlpath in the recommended way
[18470]38
39my $quoted_argv = join(" ", map { "\"$_\"" } @ARGV);
40
41
42my $buildcol_cmd = "buildcol.pl -removeold $quoted_argv";
[20925]43if($ENV{'PERLPATH'}) {
44 # need to ensure that the path to perl is quoted (in case there's spaces in it)
45 if($ENV{'GSDLOS'} =~ m/windows/) {
[19620]46 $buildcol_cmd = "\"$ENV{'PERLPATH'}\\Perl.exe\" -S $buildcol_cmd";
[19410]47 } else {
[20925]48 $buildcol_cmd = "\"$ENV{'PERLPATH'}/perl\" -S $buildcol_cmd";
[19410]49 }
[20925]50} else {
[24192]51 #Config{perlpath}, like $^X, is a special variable containing the full path to the current perl executable we are in
52 $buildcol_cmd = "\"$Config{perlpath}\" -S $buildcol_cmd";
[19409]53}
[18470]54
55my $buildcol_status = system($buildcol_cmd)/256;
56
57if ($buildcol_status != 0) {
58 print STDERR "Error: Failed to run: $buildcol_cmd\n";
59 print STDERR " $!\n" if ($! ne "");
60 exit(-1);
61}
62
63
64
65
Note: See TracBrowser for help on using the repository browser.