DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦1b091f20f⟧ TextFile

    Length: 5567 (0x15bf)
    Types: TextFile
    Notes: UNIX file
    Names: »ddainstall«

Derivation

└─⟦0cfe73749⟧ Bits:30004154/config.imd SW95707I VP/ix MS-DOS emulator Rel. 1.1
└─⟦0cfe73749⟧ UNIX Filesystem
    └─⟦this⟧ »vc/new/usr/admin/menu/packagemgmt/vpixmgmt/ddainstall« 

TextFile

#
#  Copyrighted as an unpublished work.
#  (c) Copyright 1988 INTERACTIVE Systems Corporation
#  All rights reserved.
#
#  RESTRICTED RIGHTS
#
#  These programs are supplied under a license.  They may be used,
#  disclosed, and/or copied only as permitted under such license
#  agreement.  Any copy must contain the above copyright notice and
#  this restricted rights notice.  Use, copying, and/or disclosure
#  of the programs is strictly prohibited unless otherwise provided
#  in the license agreement.
#

#ident  "@(#)ddainstall	1.1 - 88/07/27"

#menu# install a DDA device into the VP/ix Environment
#help#
#help#  This procedure allows you to "register" an add-on board for
#help#  Direct Access in the VP/ix Environment (that is, without the
#help#  support of a specially-written device emulation module).
#help#  You should not attempt this operation unless you fully
#help#  understand how to install and configure add-on boards.
#help#
#help#  Once a device has been registered, VP/ix users may request
#help#  access to it by specifying its name in their vpix.cnf files.


###########################################################################
# initialize variables
###########################################################################

BIN=/usr/vpix/etc
TMP=/tmp/ddainstall.$$

##########################################################################
# function to cleanup and exit (called with exit code as argument)
##########################################################################

cleanup()
{
     rm -f $TMP
     exit $1
}

trap 'cleanup 0' 1 2 3 9 15


###########################################################################
# function to ask whether user wants to install another device
#     returns 0 if OK to continue, 1 to quit
###########################################################################

askmore() {

REPLY=`checkyn -fe "
Do you want to install another DDA device?"`

if [ "${REPLY}" = "n" ]
then
    return 1
else
    return 0
fi
}


###########################################################################
# function to get logical name of dda device
#     returns 0 if OK, else exits
###########################################################################

getname() {
LOGICAL=
while true
do
    echo "\nPlease enter the logical name of the DDA device you want to install."
    echo "(Lower case letters will be converted to upper case letters.)\n"
    read LOGICAL

    if [ "${LOGICAL}" ]
    then

	# Convert name to upper-case

	LOGICAL=`echo ${LOGICAL} | tr "[a-z]" "[A-Z]"`

	# Ensure name is <= 10 characters in length

	if [ `expr \`echo "${LOGICAL}" | wc -c\`` -gt 12 ]
	then
	    echo "\nThe name ${LOGICAL} is too long."
	    echo "DDA device names must not be longer than 12 characters."
	    LOGICAL=
	else
	    # Check if logical name is unique

	    ${BIN}/ectcheck -N dda -L ${LOGICAL} 2> /dev/null
	    if [ $? -eq 1 ]
	    then
		echo "\nA DDA device with the logical name \"${LOGICAL}\" \
has already been installed."
		echo "To change the parameters for this device, select the \
\"vconfig\" option"
		echo "from the \"vpixmgmt\" menu."
		LOGICAL=
	    fi
	fi
    fi

    if [ -z "${LOGICAL}" ]
    then
	askmore
	if [ $? -eq 1 ]
	then
	    return 1
	fi
    else
	return 0
    fi
done
}


###########################################################################
# MAIN ROUTINE
###########################################################################

FLAGS="-qq -k$$"
answer=`checkyn ${FLAGS} -fe -H"
This procedure allows you to register an add-on
board for Direct Access in the VP/ix Environment." "
Do you wish to install a DDA device?"`

if [ "${answer}" = "n" ]
then
    cleanup 0
fi


# check whether it's OK to continue
# (must be root, VP/ix must be installed, and its version must be > 1.1)

${BIN}/iemcheck
if [ $? -ne 0 ]
then
    cleanup 1
fi

# down to business

while true
do
    # get logical name from user
    # (function returns 0 to continue, 1 to quit)

    getname
    if [ $? -eq 1 ]
    then
	cleanup 0
    fi

    # call dinstall to obtain device parameters from user
    #
    # Returns: 0  if no changes made
    #          1  if changes made
    #             (ectinstall-type arguments written to stdout)
    #          >1 if error (error message already displayed)


    ${BIN}/dinstall ${LOGICAL} $TMP
    RETCODE=$?

    # did we change anything?
    # do we have IRQ, I/O, or Controller memory parameter
    # (one at least is required)

    CHANGE=1
    ERROR=0

    if [ ${RETCODE} -eq 0 ]
    then
	CHANGE=0
    elif [ ${RETCODE} -gt 1 ]
    then
	ERROR=1
    else
	# need at least one of the three parameters

	grep "\-[VIC]" $TMP     > /dev/null 2>&1
	if [ $? -eq 1 ]
	then
	    CHANGE=0
	fi
    fi

    if [ ${ERROR} -eq 1 ]
    then
	echo "WARNING:  DDA installation for ${LOGICAL} was not completed"
	echo "because of error."
    fi

    if [ ${CHANGE} -eq 0 ]
    then
	echo "WARNING:  DDA installation for ${LOGICAL} was cancelled"
	echo "because the I/O Range, Controller memory Range, and Interrupt"
	echo "Request Number were all blank."
    else
	echo "Installing ${LOGICAL}..."
	ARGS=`cat $TMP`
	${BIN}/ectinstall -N dda -L ${LOGICAL} ${ARGS} # 2>&1 >/dev/null
	if [ $? != 0 ]
	then
	    echo "WARNING: DDA installation for ${LOGICAL} failed."
	else
	    echo "DDA installation for ${LOGICAL} is complete."
	fi
    fi

    # ask whether to continue with another device
    # (returns 0 to continue, 1 to quit)

    askmore
    if [ $? = 1 ]
    then
	cleanup 0
    fi

    # OK to continue - repeat the loop

done