#! /bin/sh
#
# @(#)setBOOTOPTIONS	1.4	LPS_UNX_COM	06/21/95
#
# Copyright 1995   Digital Equipment Corporation, Maynard, MA
#
# setBOOTOPTIONS
#
# A script that produces a value for attribute BOOTOPTIONS.
#
# Parameters:
#    $1 - LPS class identifier, one of {PC, MC, PS, ENV}
#    $2 - Operating system type identifier (eg: SV2, BSD, etc)
#    $3 - Print client type identifier (eg: AIX, BSD, SV3, etc)
#    $4 - PrintServer printer model (eg: LPS17, LPS20)
#    $5 - Default value for the attribute
#    $6 - Path of the output file to receive the final attribute value
#
# Global variables:
#    ECHON
#    FUNCS
#    PAGER
#
# Exit values:
#    0 - Success, output file contains newly set attribute value.
#    1 - Error or interruption occurred, error messages go to stderr,
#	 contents of the output file are undefined.
#
# NOTES:
#
#    This script is also designed to work quite closely with the
#    "ctrluniboot" script; this script knows it has been invoked
#    by the "ctrluniboot" script when the default value is set to
#    the string "check".
###

CLASS=$1	# Ignored
OSTYPE=$2	# Ignored
PCTYPE=$3	# Ignored
PSMODEL=$4	# Ignored
DEFVAL=$5
OUTFILE=$6

. $FUNCS   # Import the standard LPS shell functions

showhelp true "
Which booting daemon options do you want to use?

A PrintServer printer requires a BOOTP server and TFTP server to load
its system image file when the printer is powered on.  These servers
normally run as \"daemon\" processes on your system; the BOOTP daemon
is normally called \"bootpd\" and the TFTP \"daemon\" is normally
called \"tftpd\".

To use these servers requires that you copy the printer system image
file to the proper directory for TFTP services, and to create a proper
entry in the /etc/bootptab file for BOOTP services.

Alternatively, you can automatically use the PrintServer Software
\"lpsbootd\" booting daemon to do all of this for you, with no need for
any extra work on your part.  Or, you can have lpsbootd service either
BOOTP or TFTP, leaving a standard server to perform the other required
service.

You will be prompted to select which types of boot services you would
like the PrintServer Software's booting daemon \"lpsbootd\" to perform:

    bootp            Perform only the BOOTP service.

    tftp             Perform only the TFTP service.

    bootp-and-tftp   Perform both BOOTP and TFTP services.

    none             Do not perform either service, as the standard
                     servers will be used.

If you are unsure what to select, press the RETURN key to select
the default value.

For more information on this topic, please refer to the PrintServer
Software Management Guide.
"
# Ensure that the default value is one of the valid values;
# otherwise, set it to a value indicative of the current
# system configuration based on what the "chkboot" program
# tells us.

list="bootp tftp bootp-and-tftp none"

if [ -z "$DEFVAL" -o `expr "$list" : "$DEFVAL"` = "0" ]
then
###
### Extra verbosity removed for users with tiny text windows,
### since the help text above may scroll off the screen when
### the chkboot program displays verbose messages.
###
###    if [ "$DEFVAL" = "check" ]
###    then
###	echo "Checking the system for available services..."
###	echo
###	options="-v"
###    else
###	options=""
###    fi
###
###    DEFVAL=`chkboot -s $options`

    DEFVAL=`chkboot -s`	  		# Quiet and simple

fi

choose "$DEFVAL" "Booting daemon options" $list

if [ -z "$RESPONSE" ]
then
    RESPONSE="$DEFVAL"
fi

echo "$RESPONSE" > $OUTFILE

exit 0
