#! /bin/bash
#	$Id: faxsetup.sh.in,v 1.40 2004/12/28 04:45:04 lhoward Exp $
#
# Warning, this file was automatically created by the HylaFAX configure script
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# VERSION:	4.2.1
# DATE:		Sat Jan  7 22:39:43 UTC 2006
# TARGET:	ia64-unknown-linux-gnu
#

#
# faxsetup [options]
#
# This script interactively prepares and verifies 
# a HylaFAX client and/or server machine for use.
#
PATH=/bin:/usr/bin:/etc
test -d /usr/ucb  && PATH=$PATH:/usr/ucb		# Sun and others
test -d /usr/bsd  && PATH=$PATH:/usr/bsd		# Silicon Graphics
test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc	# Sun and others
test -d /usr/sbin && PATH=/usr/sbin:$PATH		# 4.4BSD-derived
test -d /usr/local/bin && PATH=$PATH:/usr/local/bin	# for GNU tools

AWK=/usr/bin/awk			# awk for use below
CAT=/bin/cat			# cat command for use below
CHGRP=/bin/chgrp			# change file group for use below
CHMOD=/bin/chmod			# change file mode for use below
CHOWN=/bin/chown			# change file owner for use below
CP=/bin/cp				# cp command for use below
ECHO=/bin/echo			# echo command for use below
ENCODING=		# encoding style for uuencode/mimencode
FUSER=/bin/fuser			# fuser command to dump in setup.cache
GREP=/bin/grep			# grep command for use below
LN=/bin/ln				# ln command for use below
LN_S=-s			# ln option for creating a symbolic link
MIMENCODE=/usr/bin/base64-encode		# mimencode command to dump in setup.cache
MKFIFO=/usr/bin/mkfifo			# FIFO creation program for use below
MV=/bin/mv				# move file for use below
RMCMD=/bin/rm			# remove file for use below
SCRIPT_SH=/bin/bash		# shell for use below
SED=/bin/sed			# sed for use below
TTYCMD=/usr/bin/tty			# tty for error output
UUENCODE=uuencode		# uuencode command to dump in setup.cache

FAX=uucp			# identity of the fax user
SERVICES=/etc/services		# location of services database
INETDCONF=/etc/inetd.conf	# default location of inetd configuration file
ALIASES=/etc/aliases		# default location of mail aliases database file
PASSWD=/etc/passwd		# where to go for password entries
PROTOUID=uucp		# user who's uid we use for FAX user
defPROTOUID=3			# use this uid if PROTOUID doesn't exist
GROUP=/etc/group		# where to go for group entries
PROTOGID=uucp		# group who's gid we use for FAX user
defPROTOGID=10			# use this gid if PROTOGID doesn't exist

VERSION="4.2.1"		# configured version
DATE="Sat Jan  7 22:39:43 UTC 2006"			# data software was configured
TARGET="ia64-unknown-linux-gnu"		# configured target

PATH_AFM=/usr/share/enscript/afm:/usr/share/fonts/afms/adobe:/usr/share/fonts/type1/gsfonts		# directory for Adobe Font Metric files
DIR_BIN=/usr/bin			# directory for client applications
DIR_LIBDATA=/etc/hylafax		# directory for client data files
DIR_LIBEXEC=/usr/sbin		# directory where servers are located
DIR_LOCKS=/var/lock	# UUCP locking directory
DIR_MAN=/usr/share/man		# directory for manual pages
DIR_SBIN=/usr/sbin			# directory for server applications
DIR_SPOOL=/var/spool/hylafax		# top of fax spooling tree

TIFFBIN=/usr/bin		# TIFF tools
LOCKS=ascii		# UUCP lock type

PATH_GETTY=/etc/hylafax/getty-link		# pathname for getty program
PATH_SENDMAIL=/usr/sbin/sendmail	# pathname for sendmail
PATH_VGETTY=/etc/hylafax/vgetty-link	# pathname for voice getty program
PATH_EGETTY=/etc/hylafax/egetty-link	# pathname for external getty program

PS=gs			# default PostScript RIP package
PATH_GSRIP=/usr/bin/gs		# pathname of Ghostscript RIP
PATH_DPSRIP=/usr/local/sbin/ps2fax.exe		# pathname of old IRIX DPS RIP
PATH_IMPRIP=/usr/lib/print/psrip		# pathname of IRIX Impressario RIP

POSIXLY_CORRECT=1; export POSIXLY_CORRECT		# disable GNU extensions

#
# Location of sysv init script
#
DIR_SYSVINIT=/etc/init.d
FAXQ_SERVER=yes
HFAXD_SERVER=yes
HFAXD_OLD_PROTOCOL=no
HFAXD_SNPP_SERVER=no

#
# These are the configuration parameters written to the
# setup.cache file and read in by all the HylaFAX scripts.
#
# We use the same names used by configure for consistency
# (but some confusion within this script).
#
VARS="SCRIPT_SH
FONTPATH		PATH_AFM
AWK
BIN		DIR_BIN
CAT
CHGRP
CHMOD
CHOWN
CP
DPSRIP		PATH_DPSRIP
ECHO
ENCODING
FAXQ_SERVER
FUSER
GREP
GSRIP		PATH_GSRIP
HFAXD_SERVER
HFAXD_OLD_PROTOCOL
HFAXD_SNPP_SERVER
IMPRIP		PATH_IMPRIP
LIBDATA		DIR_LIBDATA
LIBEXEC		DIR_LIBEXEC
LN
MANDIR		DIR_MAN
MIMENCODE
MKFIFO
MV
PATH
PATHGETTY	PATH_GETTY
PATHVGETTY	PATH_VGETTY
PATHEGETTY	PATH_EGETTY
PSPACKAGE	PS
RM		RMCMD
SBIN		DIR_SBIN
SED
SENDMAIL	PATH_SENDMAIL
SPOOL		DIR_SPOOL
SYSVINIT
TIFFBIN
TARGET
TTYCMD
UUENCODE
UUCP_LOCKDIR	DIR_LOCKS
UUCP_LOCKTYPE	LOCKS"

[ ! -d /var/spool/hylafax/etc ] && mkdir /var/spool/hylafax/etc
[ -d /var/spool/hylafax/etc ] && cp -a /etc/hylafax/* /var/spool/hylafax/etc/
[ ! -L /var/spool/hylafax/bin ] && (cd /var/spool/hylafax; ln -s etc/bin bin; cd -)

dumpvals()
{
    echo "$VARS" |
	while read a b; do eval c=\$${b:-$a}; echo "$a='$c'"; done
}

#
# Find the full pathname of an executable;
# supply a default if nothing is found.
#
findAppDef()
{
    app=$1; path=$2; def=$3
    case $app in
    /*) test -x $app && { echo $app; return; };;
    esac
    IFS=:
    for i in $path; do
	test -x $i/$app && { echo $i/$app; return; }
    done
    echo $def
}


#
# Error diagnostics that should go to the terminal are
# done with this interface or cat.
#
bitch()
{
    echo "$@" 1>&2
}

#
# This is the preferred interface for
# configure to terminate abnormally.
#
boom()
{
    $RM $JUNK
    exit 1
}

usage()
{
    cat<<EOF
Usage: faxsetup [options] [host]
Options: [defaults in brackets after descriptions]
  -client		 setup client support
  -server		 setup server support
  -with-PARAM[=ARG]      set configuration PARAM [ARG=yes]

  -help                  print this message
  -quiet                 do not print 'Using ...' messages
  -verbose		 opposite of -quiet
EOF
}

QUIET=no
isServer=no
isClient=no

onClient()
{
    test $isClient = yes
}
onServer()
{
    test $isServer = yes
}

#
# Crack command line arguments.  We purposely
# use syntax and options that are compatible
# with GNU autoconf.
#
WITHARGS=no
ac_prev=
for ac_option
do
    if [ -n "$ac_prev" ]; then		# assign the argument to previous option
	eval "$ac_prev=\$ac_option"
	ac_prev=
	continue
    fi
    case "$ac_option" in		# collect optional argument
    -*=*)	ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'`;;
    *)		ac_optarg=;;
    esac
    case "$ac_option" in
    -with-*|--with-*)
	ac_with=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
	# Reject names that are not valid shell variable names.
	if [ -n "`echo $ac_with| sed 's/[-_a-zA-Z0-9]//g'`" ]; then
	    bitch "configure: $ac_with: invalid parameter name."
	    boom
	fi
	ac_with=`echo $ac_with| sed 's/-/_/g'`
	case "$ac_option" in
	*=*)	;;
	*)	ac_optarg=yes;;
	esac
	eval "${ac_with}='$ac_optarg'"
	WITHARGS=yes
	;;
    -client)		isClient=yes;;
    -server)		isServer=yes;;

    -quiet)		QUIET=yes;;
    -verbose)		QUIET=no;;
    -help)		usage; exit 0;;
    -*)
	bitch "faxsetup: $ac_option: invalid option; use -help for usage."
	boom
	;;
    esac
done

if [ -n "$ac_prev" ]; then
    bitch "faxsetup: missing argument to --`echo $ac_prev | sed 's/_/-/g'`"
    boom
fi

# if nothing specified on command line, default client+server
if [ $isClient = no -a $isServer = no ]; then
#
# on debian the client configuration file is already bundled with the package
#
    isClient=no
    isServer=yes
fi

#
# Descriptor usage:
# 1: ???
# 2: messages that should be seen even if we're in the background.
# 3: [stdout from test runs]
# 4: verbose-style messages (Using ...)
# 5: setup.cache file
#
if [ $QUIET = yes ]; then
    exec 4>/dev/null			# chuck messages
else
    exec 4>&1				# messages go to stdout
fi

Note()
{
    echo "$@" 1>&4
}

Note ""
Note "Setup program for HylaFAX (tm) $VERSION."
Note ""
Note "Created for $TARGET on $DATE."
Note ""

CPU=`expr $TARGET : '\([^\-]*\)'` || CPU=unknown
VENDOR=`expr $TARGET : '[^\-]*-\([^-]*\)'` || VENDOR=unknown
OS=`expr $TARGET : '[^\-]*-[^\-]*-\([a-zA-Z]*\).*'` || OS=unknown
RELEASE=`(uname -r) 2>/dev/null` || RELEASE=unknown

#
# Read in any site, target, vendor, os, or os-release
# specific setup work.  Note that we read stuff here
# so that configuration parameters can be altered.  We
# use some pre-defined function names below to provide
# hooks for other actions.
#

#
# Hooks for additional client+server checks
#
otherBasicServerChecks()
{
    true
}
otherBasicClientChecks()
{
    true
}
#
# Hook for adding stuff to setup.modem
#
dumpOtherModemFuncs()
{
    true
}

#
# Figure out which brand of echo we have and define prompt
# and printf shell functions accordingly.  Note that we
# assume that if the System V-style echo is not present,
# then the BSD printf program is available.  These functions
# are defined here so that they can be tailored on a per-site,
# etc. basis.
#
if [ `echo foo\\\c`@ = "foo@" ]; then
    # System V-style echo supports \r
    # and \c which is all that we need
    prompt()
    {
       echo "$* \\c"
    }
    printf()
    {
       echo "$*\\c"
    }
    dumpPromptFuncs()
    {
	cat<<-'EOF'
	prompt()
	{
	   echo "$* \\c"
	}
	printf()
	{
	   echo "$*\\c"
	}
	EOF
    }
elif [ "`echo -n foo`@" = "foo@" ]; then
    # BSD-style echo; use echo -n to get
    # a line without the trailing newline
    prompt()
    {
       echo -n "$* "
    }
    dumpPromptFuncs()
    {
	cat<<-'EOF'
	prompt()
	{
	   echo -n "$* "
	}
	EOF
    }
else
    # something else; do without
    prompt()
    {
	echo "$*"
    }
    dumpPromptFuncs()
    {
	cat<<-'EOF'
	prompt()
	{
	    echo "$*"
	}
	EOF
    }
fi

if onServer; then
    #
    # Setup the password file manipulation functions according
    # to whether we have System-V style support through the
    # passmgmt program, or BSD style support through the chpass
    # program, or for SCO boxes through pwconv, or SVR4 style support
    # through useradd. If none are found, we setup functions that
    # will cause us to abort if we need to munge the password file.
    #
    # NB: some systems override these function definitions through
    #     per-os faxsetup files
    #
    if [ -f /bin/passmgmt -o -f /usr/sbin/passmgmt ]; then
	addPasswd()
	{
	    passmgmt -o -a -c 'Facsimile Agent' -h $4 -u $2 -g $3 $1
	}
	deletePasswd()
	{
	    passmgmt -d $1
	}
	modifyPasswd()
	{
	    passmgmt -m -h $4 -u $2 -o -g $3 $1
	}
	lockPasswd()
	{
	    passwd -l $1
	}
    elif [ -f /usr/bin/chpass ]; then
	addPasswd()
	{
	    chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:"
	}
	modifyPasswd()
	{
	    chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:"
	}
	lockPasswd()
	{
	    return 0				# entries are always locked
	}
    elif [ -f /etc/pwconv ]; then	# could be a SCO box
	addPasswd()
	{
	    echo "${1}:NOLOGIN:${2}:${3}:Facsimile Agent:${4}:/bin/false" >> ${PASSWD}
	    /etc/pwconv
	}
	lockPasswd()
	{
	    return 0				# entries are always locked
	}
	modifyPasswd()
	{
	    OLD_HOME=`grep "^${1}:" ${PASSWD} | awk -F: '{print $6}'`
	    ed - $PASSWD <<_EOF
g~^$1:~s~${OLD_HOME}~$4~
w
q
_EOF
	}
    elif [ -f /usr/sbin/useradd -o -f /etc/useradd ]; then
	addPasswd()
	{
	    useradd -c 'Facsimile Agent' -d $4 -u $2 -o -g $3 $1
	}
	deletePasswd()
	{
	    userdel $1
	}
	modifyPasswd()
	{
	    usermod -m -d $4 -u $2 -o -g $3 $1
	}
	lockPasswd()
	{
	    passwd -l $1
	}
    else
	addPasswd()
	{
	    cat >&2 <<EOF

FATAL ERROR: I don't know how to add a passwd entry!

You will have to create the password entry manually using the following info:

Login Name: $1
Password:   *
Uid:        $2
Gid:        $3
Full Name:  Facsimile Agent
Home Dir:   $4

EOF
	    boom
	}
	modifyPasswd()
	{
	    cat >&2 <<EOF

FATAL ERROR: I don't know how to modify a passwd entry!

You will have to update the password entry manually using the following info:

Login Name: $1
Password:   *
Uid:        $2
Gid:        $3
Full Name:  Facsimile Agent
Home Dir:   $4

EOF
	    boom
	}
    fi

    #
    # Functions required by faxaddmodem.
    #
    case $TARGET in
    *-sunos*|*-linux*|*-ultrix*|*-hpux*|*-freebsd*|*-netbsd*)
	dumpTTYFuncs()
	{
	    cat<<'EOF'
	    ttyPort()
	    {
		expr $1 : 'tty\(.*\)'
	    }
	    ttyLocks()
	    {
		echo $UUCP_LOCKDIR/LCK..`expr /$1 : '.*/\(.*\)'`
	    }
	    ttyAliases()
	    {
		echo /dev/$1
	    }
	    ttyDev()
	    {
		echo /dev/$1
	    }
	    checkPort()
	    {
		 return
	    }
EOF
	}
	;;
    *-svr4*|*-sysv4*|*-sysv5*|*-solaris*)
	dumpTTYFuncs()
	{
	    cat<<'EOF'
	    ttyPort()
	    {
		port=`expr $1 : 'term\/\(.*\)' \| $1`		# Usual
		port=`expr $port : 'cua\/\(.*\)' \| $port`	# Solaris
		port=`expr $port : 'tty\(.*\)' \| $port`	# Old-style
		echo $port
	    }
	    ttyLocks()
	    {
		devs=$1
		locks="$UUCP_LOCKDIR/`$SVR4UULCKN /dev/$devs`" || {
		    echo "Sorry, I cannot determine the UUCP lock file name for $devs"
		    exit 1
		}
		echo $locks
	    }
	    ttyAliases()
	    {
		echo /dev/$1
	    }
	    ttyDev()
	    {
		echo /dev/$1
	    }
	    checkPort()
	    {
		 return
	    }
EOF
	}
	;;
    *)
	dumpTTYFuncs()
	{
	    Note ""
	    Note "Beware, I am guessing the tty naming conventions for your system."
	    cat<<'EOF'
	    ttyPort()
	    {
		expr $1 : 'tty\(.*\)'
	    }
	    ttyLocks()
	    {
		echo $UUCP_LOCKDIR/LCK..`expr /$1 : '.*/\(.*\)'`
	    }
	    ttyAliases()
	    {
		echo /dev/$1
	    }
	    ttyDev()
	    {
		echo /dev/$1
	    }
	    checkPort()
	    {
		 return
	    }
EOF
	}
	;;
    esac

    case $TARGET in
    *-*bsd*)
	dumpSTTYFuncs()
	{
	    cat<<EOF
	    ttyStty()
	    {
		echo $STTYCMD -f \$tdev
	    }
	    ttySpeeds()
	    {
		speeds=
		if [ -z "\$SPEED" ]; then
		    for s in 38400 19200 9600 4800 2400 1200; do
			$STTYCMD -f \$tdev \$s </dev/null >/dev/null 2>&1 && speeds="\$speeds \$s"
		    done
		fi
		echo \$speeds
	    }
EOF
	}
	;;
    *)
	dumpSTTYFuncs()
	{
	    cat<<EOF
	    ttyStty()
	    {
		echo $STTYCMD
	    }
	    ttySpeeds()
	    {
		speeds=
		if [ -z "\$SPEED" ]; then
		    for s in 38400 19200 9600 4800 2400 1200; do
			onDev $STTYCMD \$s </dev/null >/dev/null 2>&1 && speeds="\$speeds \$s"
		    done
		fi
		echo \$speeds
	    }
EOF
	}
	;;
    esac

    machdepPasswdWork()
    {
	true
    }

    #
    # Default values for new scheduler config files
    #
    defaultLogFacility=daemon
    defaultCountryCode=1
    defaultAreaCode=
    defaultLongDistancePrefix=1
    defaultInternationalPrefix=011
    defaultDialStringRules=\"etc/dialrules\"
    defaultServerTracing=1
    defaultContCoverPage=
    defaultContCoverCmd=\"bin/mkcover\"
    defaultDestControls=
    defaultMaxConcurrentCalls=1
    defaultMaxDials=12
    defaultMaxSendPages=0xffffffff
    defaultMaxTries=3
    defaultModemGroup=
    defaultPostScriptTimeout=180
    defaultPS2FaxCmd=\"bin/ps2fax\"
    defaultSendFaxCmd=\"bin/faxsend\"
    defaultSendPageCmd=\"bin/pagesend\"
    defaultSendUUCPCmd=\"bin/uucpsend\"
    defaultSessionTracing=0xffffffff
    defaultTimeOfDay=\"Any\"
    defaultUse2D=Yes
    defaultNotifyCmd=\"bin/notify\"
    defaultUUCPLockDir=\"$DIR_LOCKS\"
    defaultUUCPLockTimeout=30
    defaultUUCPLockType=\"$LOCKS\"
fi

CONFIG_FILES=
if [ -f $DIR_SBIN/faxsetup.local ]; then
    . $DIR_SBIN/faxsetup.local
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.local"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE} ]; then
    . $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE} ]; then
    . $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE}"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS} ]; then
    . $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS} ]; then
    . $DIR_SBIN/faxsetup.${VENDOR}-${OS}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR} ]; then
    . $DIR_SBIN/faxsetup.${CPU}-${VENDOR}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR} ]; then
    . $DIR_SBIN/faxsetup.${VENDOR}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}"
elif [ -f $DIR_SBIN/faxsetup.${OS} ]; then
    . $DIR_SBIN/faxsetup.${OS}
    CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${OS}"
fi

#
# Flush cached values if something was specified on the
# command line 
#
if onServer; then
    REASON=
    if [ $WITHARGS = yes ]; then 
	REASON="of command line parameters"
    elif [ "$CONFIG_FILES" ]; then
	REASON=`find $CONFIG_FILES -newer $DIR_SPOOL/etc/setup.cache -print 2>/dev/null`
	test "$REASON" && REASON="$REASON has been updated"
    fi
    if [ "$REASON" -a -f $DIR_SPOOL/etc/setup.cache ]; then
       Note "Flushing cached parameters because $REASON."
       Note ""
       rm -f $DIR_SPOOL/etc/setup.cache
    fi
    if [ -f $DIR_SPOOL/etc/setup.cache ]; then
	Note "Reading cached parameters from $DIR_SPOOL/etc/setup.cache."
	Note ""
	. $DIR_SPOOL/etc/setup.cache
    fi
fi

#
# Double-check these settings...
#
test -x "$MIMENCODE" || {
    MIMENCODE=`findAppDef mimencode $PATH mimencode`
    test -x $MIMENCODE || {
	MIMENCODE=`findAppDef base64-encode $PATH base64-encode`
    }
    Note "Found encoder: $MIMENCODE"
}
test -x "$UUENCODE" || {
    UUENCODE=`findAppDef uuencode $PATH uuencode`
    Note "Found encoder: $UUENCODE"
}
if [ -x "$MIMENCODE" ]; then
    if [ "$ENCODING" != "base64" ]; then
	ENCODING=base64
	Note "Looks like $MIMENCODE supports base64 encoding."
    fi
elif [ -x "$UUENCODE" ]; then
    if capture "$UUENCODE -m $PASSWD foo"; then
	if [ "$ENCODING" != "base64" ]; then
	    ENCODING=base64
	    Note "Looks like $UUENCODE supports base64 encoding."
	fi
    else
	if [ "$ENCODING" != "x-uuencode" ]; then
	    ENCODING=x-uuencode
	    Note "Looks like $UUENCODE does not support base64 encoding."
	fi
    fi
fi

RM="$RMCMD -f"				# remove file for use below

#
# Deduce the effective user id:
#   1. POSIX-style, the id program
#   2. the old whoami program
#   3. last gasp, check if we have write permission on /dev
#
euid=`id|$SED -e 's/.*uid=[0-9]*(\([^)]*\)).*/\1/'`
test -z "$euid" && euid=`(whoami) 2>/dev/null`
test -z "$euid" -a -w /dev && euid=root
if [ "$euid" != "root" ]; then
    bitch "Sorry, but you must run this script as the super-user!"
    boom
fi

onClient && Note "Checking system for proper client configuration."
onServer && Note "Checking system for proper server configuration."

#
# Verify configuration parameters are correct.
#

dirMisConfigured()
{
   cat >&2 <<EOF

FATAL ERROR: $1 does not exist or is not a directory!

The directory $1 does not exist or this file is not a directory.  If
the HylaFAX software is not yet installed you must do so before running
this script.  If the software is installed but is configured for use in
a different location than this script expects then the software will not
function correctly.

EOF
   boom
}

#
# Check basic spooling area setup.
#
if onServer; then
    test -d $DIR_SPOOL || {
	cat >&2 <<-EOF

	FATAL ERROR: $DIR_SPOOL does not exist or is not a directory!

	The HylaFAX spooling area $DIR_SPOOL does not exist or this file is
	not a directory.  If the HylaFAX software is not yet installed you
	must do so before running this script.  If the software is installed
	but is configured for use in a different location than this script
	expects then you may override the default pathname by running this
	script with a -with-DIR_SPOOL option; e.g.

	faxsetup -with-DIR_SPOOL=/var/spool/someplace_unexpected

	EOF
	boom
    }
    cd $DIR_SPOOL
    DIRS="archive bin client config dev docq doneq etc info log\
	pollq recvq sendq status tmp"
    for i in $DIRS; do
	test -d $i || dirMisConfigured $DIR_SPOOL/$i
    done
    #
    # XXX should check permission and ownership of sensitive dirs
    #

    JUNK="etc/setup.tmp"
    trap "$RM \$JUNK; exit 1" 1 2 15

    exec 5>etc/setup.tmp
    echo '# Warning, this file was automatically generated by faxsetup' >&5
    echo '# on' `date` "for ${USER:-$euid}" >&5
fi

#
# Basic client installation.
#
if onClient; then
    test -d $DIR_BIN	 || dirMisConfigured $DIR_BIN
    for file in sendfax sendpage faxstat faxalter faxcover faxmail faxrm; do
	test -x $DIR_BIN/$file || {
	    cat >&2 <<EOF

FATAL ERROR: $DIR_BIN/$file is not an executable program!

The file $DIR_BIN/$file does not exist or this file is not
an executable program.  If the HylaFAX software is not yet installed you
must do so before running this script.  If the software is installed but
is configured for use in a different location than this script expects
then the software will not function correctly.

EOF
	   boom
	}
    done
    test -d $DIR_LIBDATA || dirMisConfigured $DIR_LIBDATA
    for file in pagesizes faxcover.ps typerules; do
	test -f $DIR_LIBDATA/$file || {
	    cat >&2 <<EOF

FATAL ERROR: $DIR_LIBDATA/$file does not exist!

The file $DIR_LIBDATA/$file does not exist.  If the HylaFAX
software is not yet installed you must do so before running this script.
If the software is installed but is configured for use in a different
location than this script expects then the software will not function
correctly.

EOF
	   boom
	}
    done
    test -d $DIR_LIBEXEC || dirMisConfigured $DIR_LIBEXEC
    for file in textfmt; do
	test -f $DIR_LIBEXEC/$file || {
	    cat >&2 <<EOF

FATAL ERROR: $DIR_LIBEXEC/$file does not exist!

The file $DIR_LIBEXEC/$file does not exist.  If the HylaFAX
software is not yet installed you must do so before running this script.
If the software is installed but is configured for use in a different
location than this script expects then the software will not function
correctly.

EOF
	   boom
	}
    done

    otherBasicClientChecks
fi

#
# Server setup other than the spooling area.
#
if onServer; then
    test -d $DIR_LIBEXEC || dirMisConfigured $DIR_LIBEXEC
    test -d $DIR_SBIN	 || dirMisConfigured $DIR_SBIN
    test -d $DIR_LOCKS   || {
       cat >&2 <<EOF

FATAL ERROR: $DIR_LOCKS does not exist or is not a directory!

The UUCP lockfile directory is not where it is expected or this file
is not a directory.  It is possible to configure the HylaFAX software
to use a directory other than the configured one by setting up the
UUCPLockDir configuration parameter in each configuration file in the
$DIR_SPOOL/etc directory, but this is potentially error-prone.
Your best bet is to either create a symbolic link for the expected
pathname or reconfigure HylaFAX with the correct pathname and build
a new distribution.
EOF
	boom
    }
    test -d $TIFFBIN	|| {
	cat >&2 <<EOF

FATAL ERROR: $TIFFBIN does not exist or is not a directory!

The directory of tools from the TIFF software distribution is not
where it is expected or this file is not a directory.  If you do not
have the TIFF distribution installed on this machine then you must
install it; the master FTP location is ftp://ftp.sgi.com/graphics/tiff.
Otherwise, if the software is installed in a directory other than
where it is expected you can configure the HylaFAX software to use
an alternate directory by supplying a -with-TIFFBIN option when running
this script; e.g. faxsetup -with-TIFFBIN=someplace_nonstandard.

EOF
	boom
    }
    for file in tiffcp tiff2ps fax2ps tiffinfo; do
	test -x $TIFFBIN/$file	|| {
	    cat >&2 <<EOF

FATAL ERROR: $TIFFBIN/$file does not exist or is not an executable program!

The program $TIFFBIN/$file is not where it is expected or the file
is not executable.  This program is part of the TIFF software
distribution that is required for use with HylaFAX.  If you do not
have the TIFF distribution installed on this machine then you must
install it; the master FTP location is ftp://ftp.sgi.com/graphics/tiff.
Otherwise, if the software is installed in a directory other than
where it is expected you can configure the HylaFAX software to use
an alternate directory by supplying a -with-TIFFBIN option when running
this script; e.g.  faxsetup -with-TIFFBIN=someplace_nonstandard.

EOF
	    boom
	}
    done

    otherBasicServerChecks
fi

#
# Quick check to see if the manual pages are installed;
# perhaps not even worth the effort.
#
test -d $DIR_MAN || {
    cat >&4 <<EOF


Warning: $DIR_MAN does not exist or is not a directory!

The directory for manual pages does not exist or is not a directory.
If this directory does not exist because the manual pages have not been
installed then you can ignore this message.  Otherwise you may want to
check out what happened to the manual pages.
EOF
}

#
# Utility program parameters.
#
appMisConfigured()
{
   cat >&2 <<EOF

FATAL ERROR: $1 does not exist or is not an executable program!

The file:

    $1

does not exist or this file is not an executable program.  The HylaFAX
software expects this program to exist and be in this location.  If the
program resides in a different location then you must either reconfigure
and rebuild HylaFAX or override the default pathnames in the distributed
software through one of the HylaFAX configuration files (consult the
HylaFAX documentation).

EOF
   boom
}
warnAppMisConfigured()
{
   cat >&2 <<EOF


Warning: $1 does not exist or is not an executable program!

The file:

    $1

does not exist or this file is not an executable program.  The
HylaFAX software optionally uses this program and the fact that
it does not exist on the system is not a fatal error.  If the
program resides in a different location and you do not want to
install a symbolic link for $1 that points to your program
then you must reconfigure and rebuild HylaFAX from source code.
EOF
}

if onServer; then
    test -x $PATH_GETTY		|| warnAppMisConfigured $PATH_GETTY
    test -x $PATH_VGETTY	|| warnAppMisConfigured $PATH_VGETTY
    test -x $PATH_EGETTY	|| warnAppMisConfigured $PATH_EGETTY

    for i in $CAT $CHGRP $CHMOD $CHOWN $CP $ECHO $GREP $LN $MKFIFO $MV \
	$RMCMD $SED $SENDMAIL; do
	test -x $i || appMisConfigured $i
    done

    #
    # Test/verify we know how to create FIFO special files.
    #
    case $MKFIFO in
    *mknod)
	mkfifo()
	{
	    $MKFIFO $1 p
	}
	;;
    *)
	mkfifo()
	{
	    $MKFIFO $1
	}
	;;
    esac
    $RM conffifo; JUNK="$JUNK conffifo"
    if (mkfifo conffifo && test -p conffifo) >/dev/null 2>&1; then
	true
    elif test -r conffifo; then			# NB: not everyone has test -p
	true
    else
	cat >&2 <<EOF

FATAL ERROR: Don't know how to create FIFO special files!

We were unable to create a FIFO special file using the command:

     $MKFIFO conffifo

HylaFAX requires support for FIFO special files and will not function
without this support.  If your system does not have support for FIFO
files then reconfigure it to include support (on some systems this
support is optional and requires recompilation or rebuilding of the
kernel).  If your system does have support for FIFO files but they are
not created using the expected program then you will need to reconfigure
and rebuild HylaFAX from the source distribution or emulate the needed
functionality (possibly by providing a shell script).

EOF
	boom
    fi
fi

#
# AWK support.
#
if onServer; then
    test -x $AWK		|| appMisConfigured $AWK
    # awk must support functions and -v
    CheckAwk()
    {
	($1 -v BAR=bar '
    function foo(x) {
    print "GOT" x
    }
    BEGIN { foo(BAR) }
    ' </dev/null | grep GOTbar) >/dev/null 2>&1
	return
    }
    CheckAwk $AWK || {
	cat >&2 <<EOF

FATAL ERROR: $AWK does not support needed functionality!

The following test does not work correctly with the configured awk program.

----------------------------------------------------------
$AWK -v BAR=bar '
function foo(x) {
print "GOT" x
}
BEGIN { foo(BAR) }
' </dev/null | grep GOTbar
----------------------------------------------------------

The HylaFAX software requires an awk program that supports functions and
the -v option for passing parameters from the command line.  The deficiency
of $AWK on your system will cause problems in various parts of the HylaFAX
software.

If you are running an old version of $AWK then get a more up to date
version.  Otherwise you can reconfigure HylaFAX from the source distribution
to force a different awk program to be used or you can, as a last resort,
try altering the shell scripts that are part of HylaFAX that use $AWK.

EOF
	boom
    }
fi

#
# Runtime Fontpath/Fontmap detection
#
if onClient; then
	getGSFonts()
	{
		$PATH_GSRIP -h 2>/dev/null | $AWK -F '[ ]' '
			BEGIN { start = 0; }
			/Search path:/ { start = 1 }
			{
				if (start == 1) {
						if ($1 == "") {
						gsub(" ","")
						gsub("^[.]","")
						gsub("^:","")
						printf "%s", $0
					} else if ($1 != "Search") start = 0
				}
			}	
		'
	}
	RUNTIME_PATH_AFM=`getGSFonts`
	if [ -n "$RUNTIME_PATH_AFM" \
				-a "$RUNTIME_PATH_AFM" != "$PATH_AFM" ]; then 
	    Note ""
	    Note "Setting Ghostscript font path in $DIR_LIBDATA/hyla.conf."
	    Note ""
	    if [ -f $DIR_LIBDATA/hyla.conf ]; then
		$AWK '!/^FontMap|^FontPath|\/FontPath added by/ { print }' \
			$DIR_LIBDATA/hyla.conf > $DIR_LIBDATA/hyla.conf.tmp
	    fi
	    echo "# FontMap/FontPath added by faxsetup (`date 2>/dev/null`)" \
	                                        >> $DIR_LIBDATA/hyla.conf.tmp
	    echo "FontMap:   $RUNTIME_PATH_AFM" >> $DIR_LIBDATA/hyla.conf.tmp
	    echo "FontPath:  $RUNTIME_PATH_AFM" >> $DIR_LIBDATA/hyla.conf.tmp
	    $MV $DIR_LIBDATA/hyla.conf.tmp $DIR_LIBDATA/hyla.conf
	    PATH_AFM=$RUNTIME_PATH_AFM
	fi
fi

#
# Installation of Adobe Font Metric files
#
if onClient; then
    FDIRS=`echo $PATH_AFM | sed "s/:/ /g"`
    MATCH=
    for FDIR in $FDIRS; do
    if [ -d $FDIR ]; then
	cd $FDIR
	if [ -n "`ls | grep '\.afm'`" ] || [ -f Courier ]; then
		MATCH=$FDIR
		break
	fi
    else
	cat >&4 <<EOF


Warning: $FDIR does not exist or is not a directory!

The directory $FDIR does not exist or this file is not a directory.
This is the directory where the HylaFAX client applications expect to
locate font metric information to use in formatting ASCII text for
submission as facsimile.  Without this information HylaFAX may generate
illegible facsimile from ASCII text.

EOF
    fi
    done
    if [ -z "$MATCH" ];then
	    cat >&4 <<EOF


Warning: Font metric information files were not found!

The font metric information file for the Courier font was not found in
the $PATH_AFM path.  This means that client HylaFAX applications 
that use this information to format ASCII text for submission as fax will
use incorrect information and generate potentially illegible facsimile.

If font metric information is present on your system in a directory other
than $PATH_AFM then you can setup a symbolic link to the appropriate
directory or you can specify the appropriate pathname in the configuration
file $DIR_LIBDATA/hyla.conf with a line of the form:

FontPath:	someplace_unexpected

If you do not have the font metric information files loaded on your system
system you can obtain them by public FTP from the place where you obtained
the HylaFAX software or from the master FTP site at ftp.sgi.com.
EOF
     fi
fi

#
# PostScript RIP support.
#
if onServer; then
    cd $DIR_SPOOL
    #
    # Force bin/ps2fax and bin/pdf2fax to point to the appropriate scripts.
    #
    Note ""
    Note "Make $DIR_SPOOL/bin/ps2fax a link to $DIR_SPOOL/bin/ps2fax.$PS."
    Note ""
    $RM bin/ps2fax
    $RM bin/pdf2fax
    if [ -n "$LN_S" ]; then
	$LN $LN_S ps2fax.$PS bin/ps2fax;
	if [ $PS = gs ]; then
	    Note ""
	    Note "Make $DIR_SPOOL/bin/pdf2fax a link to $DIR_SPOOL/bin/pdf2fax.$PS."
	    Note ""
	    $LN $LN_S pdf2fax.$PS bin/pdf2fax;
	else
	    Note ""
	    Note "Server-side PDF conversion is not supported on this system."
	    Note ""
	fi
    else
	$LN bin/ps2fax.$PS bin/ps2fax;
	if [ $PS = gs ]; then
	    Note ""
	    Note "Make $DIR_SPOOL/bin/pdf2fax a link to $DIR_SPOOL/bin/pdf2fax.$PS."
	    Note ""
	    $LN bin/pdf2fax.$PS bin/pdf2fax;
	else
	    Note ""
	    Note "Server-side PDF conversion is not supported on this system."
	    Note ""
	fi
    fi
fi

#
# Find the full pathname of a file
# using the specified test operation.
#
findThing()
{
    t="$1"; app=$2; path=$3;
    case $app in
    /*) eval $t $app && { echo $app; return; };;
    esac
    IFS=:
    for i in $path; do
	eval $t $i/$app && { echo $i/$app; return; }
    done
}

#
# Find the full pathname of an executable.
#
findApp()
{
    findThing "test -x" $1 $2
}

#
# Deal with known alternate locations for system files.
#
PickFile()
{
    for i do
	test -f $i && { echo $i; return; }
    done
    echo $1
}

INETDCONF=`PickFile	$INETDCONF /etc/inetd.conf /etc/inet/inetd.conf`
ALIASES=`PickFile	$ALIASES   /etc/aliases /etc/ucbmail/aliases /etc/mail/aliases /usr/mmdf/table/alias.user /usr/mmdf/table/alias.n /etc/postfix/aliases`
SERVICES=`PickFile	$SERVICES  /etc/inet/services`
test -f /etc/master.passwd	&& PASSWD=/etc/master.passwd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and define
# promptd

#
# Figure out which brand of echo we have and defi