#!/bin/sh

# mkbb.bkg
# SHELL SCRIPT TO DETERMINE THE BACKGROUND COLOR OF THE BIG BROTHER PAGE
# BIG BROTHER CLIENT PROGRAM
# Sean MacGuire - The MacLawran Group Inc.
# Version 1.4
# Mar 05th, 2000
#
# This program is Copyright (c) 1997-2000
# The MacLawran Group Inc.
# All Rights Reserved

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
        . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi

$RM -f $BBTMP/BB

#
# NOW ESTABLISH THE BACKGROUND COLOR...
# IF THERE'S ANY EMERGENCY FILES, THEN WE'RE RED
# THEN IF YELLOW
# THEN IF PURPLE
#
BKG="green"

thisdir=`pwd`
cd $BBLOGS
for COLOR in yellow purple red
do
	if [ "$SUMMARY_SET_BKG" = "TRUE" ]
	then
		$GREP -l "^${COLOR}" * >> $BBTMP/BB
	else
		$GREP -l "^${COLOR}" * | $GREP -v "summary." >> $BBTMP/BB
	fi
	if test "$?" = "0"
	then
		BKG="$COLOR" 		# SET THE COLOR
	fi
done
cd $thisdir

echo $BKG > $BBLOGS/.bkg		# SAVE THE COLOR HERE
