#!/bin/csh -f
# **********************************************************************
#         Copyright IBM Corporation 1988,1991 - All Rights Reserved      *
#        For full copyright information see:'andrew/config/COPYRITE'     *
# **********************************************************************
# $Disclaimer: 
# Permission to use, copy, modify, and distribute this software and its 
# documentation for any purpose is hereby granted without fee, 
# provided that the above copyright notice appear in all copies and that 
# both that copyright notice, this permission notice, and the following 
# disclaimer appear in supporting documentation, and that the names of 
# IBM, Carnegie Mellon University, and other copyright holders, not be 
# used in advertising or publicity pertaining to distribution of the software 
# without specific, written prior permission.
# 
# IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 
# DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 
# SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#  $
#############################
# SAMPLE.driver
# a sample script that sets up the environment vars for and calls
# wpbuild; the script that performs White Pages (WP) updating.
#
# Edit a copy of this script to insert the values appropriate to the particular
# WP that is to be updated.  DO NOT EDIT wpbuild itself!
# See the ``Installing the White Pages'' chapter of the Andrew Message System
# manual for details on what environment variables you may need to set.
#
# This sample script rebuilds the site WP, that is, the WP residing
# in the directory ``/afs/CELLNAME/service/wp'', where CELLNAME is the domain
# name of the site.  If you wish to rebuild a WP that is in a non-standard location,
# you will need to define the WPDestDir var.  Again, see ``Installing the WP'' for
# details.
#############################
# PWFile is the name of the file containing the "passwd" information.
# AffilSrc is the file containing affiliations for each user.  If it exists,
#   it contains lines of the form userid:affilabbr, where affilabbr is a space-separated
#   list of affiliations.
# AffilMap is the file mapping those affiliation names to full names
#   (for example, the full names for departments).  If it exists, it contains
#   lines of the form ``affilabbr:full affiliation name''.

# WPWorkDir is the directory where the work will be done.
# This directory must contain the subdirectories "hist" and "names",
# in which state will be maintained between wpbuild runs.

# wpbuildOpts is -f if we want makeboth to find ~/.forward files;
# it is -F if we don't want to bother with ~/.forward files.

# WPBackupDir is a directory for keeping consistent snapshots
# (in the form of tar files) of the white pages database and the
# state files that describe its contents.

# WPIChangesDir, if defined, is a directory into which approved
# update requests from the interactive White Pages updater
# procedure are placed.  (This definition is not defaulted here.)

#
# set eiger.cc.podunk.edu's environment for a WP update and call wpbuild.
#
setenv ANDREWDIR /ext/Andrew
setenv ThisCellName 'eiger.cc.podunk.edu'
setenv WPWorkDir '/usr/wpd/wpbuild'
setenv WPBackupDir '/usr/etc/backup/wp'
# ...the rest of the environment vars will be defaulted by wpbuild.
# passwd info is assumed to be in /etc/passwd.
#

set and_dir=/usr/andrew
if ( ${?ANDREWDIR} ) then
	set and_dir=$ANDREWDIR
endif

# These two variables say where the "makeboth" and "nickgen"
# programs are to be found.
if ( ! ${?MakeBothPgm} ) set MakeBothPgm=${and_dir}/etc/makeboth
if ( ! ${?NickGenPgm} ) set NickGenPgm=${and_dir}/etc/nickgen

# Try to get to the FS command.
set FS=echo
if ( -x ${and_dir}/bin/fs ) set FS=${and_dir}/bin/fs

# WPDestFile is the file in WPDestDir that will be the root of
# the White Pages b-tree.
if ( ! ${?WPDestFile} ) set WPDestFile=wp
# 
# crank up wpbuild
echo "Environment set; entering wpbuild at `date`" > /dev/console
${ANDREWDIR}/etc/wpbuild
set exitstat=$status
if ($exitstat != 0) then
    echo "wpbuild returned with failure status $exitstat at `date`" > /dev/console
endif
exit $exitstat
# end of script
