head	1.12;
access;
symbols
	TIGRIS_1_1_0RC2:1.12
	TIGRIS_1_1_0RC1:1.12
	TIGRIS_1_1:1.12.0.12
	TIGRIS_1_0_8:1.12
	TIGRIS_1_0_8RC3:1.12
	TIGRIS_1_0_8RC2:1.12
	TIGRIS_1_0_8RC1:1.12
	TIGRIS_1_0_7:1.12
	TIGRIS_1_0_7RC3:1.12
	TIGRIS_1_0_7RC2:1.12
	TIGRIS_1_0_7RC1:1.12
	TIGRIS_1_0_6:1.12
	TIGRIS_1_0_6RC5:1.12
	TIGRIS_1_0_6RC4:1.12
	TIGRIS_1_0_6RC3:1.12
	TIGRIS_1_0_6RC2:1.12
	TIGRIS_1_0_6RC1:1.12
	TIGRIS_1_0_5:1.12
	TIGRIS_1_0_5RC6:1.12
	TIGRIS_1_0_5RC5:1.12
	TIGRIS_1_0_5RC4:1.12
	TIGRIS_1_0_5RC3:1.12
	TIGRIS_1_0_5RC2:1.12
	TIGRIS_1_0_5RC1:1.12
	TIGRIS_1_0_4:1.12
	TIGRIS_1_0_3:1.12
	TIGRIS_1_0_2:1.12
	TIGRIS_1_0_1:1.12
	TIGRIS_1_0:1.12.0.14
	TIGRIS_1_0_0:1.12
	TIGRIS_1_0_0_RC1:1.12.0.10
	HELM_PEER_PORT_BRANCH:1.12.0.8
	TIGRIS_0_9_2_4:1.12
	TIGRIS_0_9_2_3:1.12
	TIGRIS_0_9_2:1.12.0.6
	TIGRIS_0_9_0:1.12.0.4
	TIGRIS_0_8_4:1.12.0.2
	TIGRIS_710_FF:1.12
	TIGRIS_706:1.11
	TIGRIS_705:1.11
	TIGRIS_704:1.11
	TIGRIS_703:1.11
	TIGRIS_702:1.11
	TIGRIS_701:1.11
	TIGRIS_SEP_13_2000:1.11.0.2
	TIGRIS_BASELINE:1.11;
locks; strict;
comment	@# @;


1.12
date	2000.11.01.03.25.29;	author jon;	state Exp;
branches;
next	1.11;

1.11
date	2000.08.22.19.42.58;	author ed;	state Exp;
branches;
next	1.10;

1.10
date	2000.08.16.21.30.12;	author ed;	state Exp;
branches;
next	1.9;

1.9
date	2000.08.14.22.10.56;	author ed;	state Exp;
branches;
next	1.8;

1.8
date	2000.07.26.02.05.36;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2000.07.26.00.37.59;	author elicia;	state Exp;
branches;
next	1.6;

1.6
date	2000.07.25.23.03.52;	author kmaples;	state Exp;
branches;
next	1.5;

1.5
date	2000.07.13.22.35.01;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2000.07.13.21.21.40;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2000.07.13.04.26.07;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2000.07.12.19.29.33;	author jon;	state Exp;
branches;
next	1.1;

1.1
date	2000.07.12.18.14.38;	author jon;	state Exp;
branches;
next	;


desc
@@


1.12
log
@check in ed's modifications so that this script will work with my tcsh
setup.
@
text
@#!/usr/bin/perl -w
# env_check: Assures that all the necessary environment configuration 
# variables have been set.  Executed from configure.pl as a sanity check for 
# the preprocessor.
#
# $Id: env_check,v 1.11 2000/08/22 19:42:58 ed Exp $
#

# Without knowing where the sandbox is, nothing can happen at all.
die(var_not_defined_msg('SANDBOX')) unless defined($ENV{'SANDBOX'});

use Getopt::Long;
# Look at the command line options.
my %options = ();
my $result = GetOptions(\%options, 't' );
if (not $result) {
    die 'invalid command line options(??)';
}
my $tcsh_env_export = 0;
if ($options{'t'}) {
    $tcsh_env_export = 1;
}

# File to read the list of required environment variables from.
my $DATA_FILE = "$ENV{'SANDBOX'}/scripts/env.sh";

# Scrit exit status, taking an optimistic outlook on things.
my $status    = 0;

my @@conf_vars = ();

if (open(CONF, $DATA_FILE)) {
    # Get the list of environment confiuration variables.
    @@conf_vars = parse_conf_vars(*CONF);
    #print '@@conf_vars=', "@@conf_vars\n";
    close(CONF);
}
else
{
    die "Unable to open '$DATA_FILE' for reading.\n";
}


my $msg = '';
my $error_msg = '';

# Check each environment variable.
foreach my $var_name (@@conf_vars)
{
    #print '$var_name=', "$var_name\n";
    if ($tcsh_env_export) {
        $msg .= "setenv $var_name '".(defined($ENV{$var_name}) ? 
                    $ENV{$var_name} : '')."';\n";
    } else {
        $msg .= "$var_name ";
    }

    # Check for the existance of each variable.
    defined($ENV{$var_name}) || eval
    {
        $error_msg .= var_not_defined_msg($var_name);
        $status = 1;
    }
}

if ($status or ! $tcsh_env_export) {
    print "$msg";
    print "\n";
    print "$error_msg";
    exit $status;
}

print "$msg\n";
exit $status;


# Creates a message warning that the specified environment variable isn't 
# defined.
#
# ex. var_not_defined_msg;
sub var_not_defined_msg
{
    my $var_name = shift;
    return "\nThe $var_name environment configuration variable does not " . 
        "exist.\nPlease set a value for this variable.\n";
}

# Returns a list of the environment configuration variable names.
#
# ex. my @@conf_vars = parse_conf_vars(OPEN_FILE_DESCRIPTOR);
sub parse_conf_vars
{
    my $in = shift || return;

    my @@conf_vars = ();
    my $tokenizing = 0;
    while (<$in>)
    {
        if ($tokenizing) 
        {
            # Parse env var names.
            chomp;
            s/"//g;
            #print 'Parsing tokens from: ', "$_\n";
            my @@line = split(/\s+/);

            # Check for line continuation character.
            my $done_parsing = !($line[$#line] eq "\\");
            shift(@@line); 
            pop(@@line) unless $done_parsing;
            push(@@conf_vars, @@line);
            last if $done_parsing;
        }

        # Look for spot to start snatching up tokens (the line starting with 
        # 'CONF_VARS=').
        $tokenizing = 1 if (!$tokenizing and /^\s*CONF_VARS\s*=/);
    }
    return @@conf_vars;
}

@


1.11
log
@document the switch from move_sandbox to configure.pl in various places.
@
text
@d6 1
a6 1
# $Id: env_check,v 1.10 2000/08/16 21:30:12 ed Exp $
d12 12
d44 3
d51 6
a56 1
    print "$var_name ";
d61 1
a61 1
        print var_not_defined_msg($var_name);
a64 1
print "\n";
d66 8
d84 1
a84 1
    return "The $var_name environment configuration variable does not " . 
d121 1
@


1.10
log
@properly handle a conf variable which may be defined but false in the
perl sense (eg IF_GATED)
@
text
@d3 1
a3 1
# variables have been set.  Executed from move_sandbox as a sanity check for 
d6 1
a6 1
# $Id: env_check,v 1.9 2000/08/14 22:10:56 ed Exp $
@


1.9
log
@this change is used by configure.pl.  basically, this way it isn't
necessary to make changes to both env.sh and configure.pl; just the
former will suffice.
@
text
@d6 1
a6 1
# $Id: env_check,v 1.8 2000/07/26 02:05:36 dlr Exp $
d39 1
a39 1
    $ENV{$var_name} || eval
@


1.8
log
@Reworked to handle the running of the env_check script from anywhere.
@
text
@d6 1
a6 1
# $Id: env_check,v 1.7 2000/07/26 00:37:59 elicia Exp $
d36 1
d45 1
@


1.7
log
@[davidp] Added reassuring exit message if no missing variables were found.
@
text
@d6 1
a6 1
# $Id: env_check,v 1.6 2000/07/25 23:03:52 kmaples Exp $
d9 6
d17 1
d20 9
a28 8
if(open(CONF, 'env.sh')){
	print "Fetching configuration variables from 'env.sh'.\n";
	# Get the list of environment confiuration variables.
	@@conf_vars = parse_conf_vars(*CONF);
	#print '@@conf_vars=', "@@conf_vars\n";	
	close(CONF);
} else {
	print "WARNING: unable to open 'env.sh' for reading.\n";
d40 1
a40 2
        print "The $var_name environment configuration variable does not ";
        print "exist.\nPlease set a value for this variable.\n";
d45 1
a45 1
if ($status == 0) {print "All's well!\n";}
a46 1
exit $status;
d48 10
a91 1

@


1.6
log
@Fixed condition causing 'Read on closed filehandle' error.
@
text
@d6 1
a6 1
# $Id: $
d37 2
@


1.5
log
@Made the regex used to find where to start grabbing var names a little
more robust.
@
text
@d6 1
a6 1
# $Id: env_check,v 1.4 2000/07/13 21:21:40 dlr Exp $
d10 2
a11 1
my $status = 0;
d13 9
a21 5
open(CONF, 'env.sh');

# Get the list of environment confiuration variables.
my @@conf_vars = parse_conf_vars(CONF);
#print '@@conf_vars=', "@@conf_vars\n";
a22 1
close(CONF);
d46 1
a46 1
    my $in = shift;
d74 1
@


1.4
log
@Modified env_check (called by move_sandbox) to be slightly more dynamic by parsing env.sh for the names of the prerequisite variables.  Modified other files accordingly.
@
text
@d6 1
a6 1
# $Id: $
d66 1
a66 1
        $tokenizing = 1 if (!$tokenizing and $_ =~ /^CONF_VARS\s*=/);
@


1.3
log
@Added USE_COOKED_TEMPLATES env var.
@
text
@d1 18
a18 1
#!/bin/sh
d20 18
a37 3
# this sucks but is the key to a better solution which a decent
# scripting person should be able to figure out (i am not one)
# this code is executed from move_sandbox
d39 24
a62 1
# jon@@collab.net
d64 6
a69 48
if [ -z $BRAND ] ; then
    echo "BRAND environment variable does not exist. Please fix."
fi
if [ -z $BRANDSITE ] ; then
    echo "BRANDSITE environment variable does not exist. Please fix."
fi
if [ -z $SANDBOX ] ; then
    echo "SANDBOX environment variable does not exist. Please fix."
fi
if [ -z $HOSTNAME ] ; then
    echo "HOSTNAME environment variable does not exist. Please fix."
fi
if [ -z $SERVLET_TEMPLATE_ROOT ] ; then
    echo "SERVLET_TEMPLATE_ROOT environment variable does not exist. Please fix."
fi
if [ -z $BRAND_TEMPLATE_ROOT ] ; then
    echo "BRAND_TEMPLATE_ROOT environment variable does not exist. Please fix."
fi
if [ -z $HTDOC_ROOT ] ; then
    echo "HTDOC_ROOT environment variable does not exist. Please fix."
fi
if [ -z $DOMAIN ] ; then
    echo "DOMAIN environment variable does not exist. Please fix."
fi
if [ -z $MAIL_HOST ] ; then
    echo "MAIL_HOST environment variable does not exist. Please fix."
fi
if [ -z $MAIL_LIST ] ; then
    echo "MAIL_LIST environment variable does not exist. Please fix."
fi
if [ -z $MAIL_ACCOUNT ] ; then
    echo "MAIL_ACCOUNT environment variable does not exist. Please fix."
fi
if [ -z $DATABASE_HOST ] ; then
    echo "DATABASE_HOST environment variable does not exist. Please fix."
fi
if [ -z $DATABASE_NAME ] ; then
    echo "DATABASE_NAME environment variable does not exist. Please fix."
fi
if [ -z $DATABASE_USER ] ; then
    echo "DATABASE_USER environment variable does not exist. Please fix."
fi
if [ -z $DATABASE_PASSWORD ] ; then
    echo "DATABASE_PASSWORD environment variable does not exist. Please fix."
fi
if [ -z $USE_COOKED_TEMPLATES ] ; then
    echo "USE_COOKED_TEMPLATES environment variable does not exist. Please fix."
fi
@


1.2
log
@removed check for SITE_ROOT. it isn't needed
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d54 3
@


1.1
log
@reports an error if an env variable has not been set
@
text
@a17 3
if [ -z $SITE_ROOT ] ; then
    echo "SITE_ROOT environment variable does not exist. Please fix."
fi
@

