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 - download

⟦0ae614056⟧ TextFile

    Length: 3213 (0xc8d)
    Types: TextFile
    Notes: UNIX file
    Names: »add_lanmux«

Derivation

└─⟦104d96909⟧ Bits:30004765 SW95718I UNIX LAN Server Rel. 1.1
└─⟦104d96909⟧ UNIX Filesystem
    └─ ⟦this⟧ »LS/new/usr/admin/menu/packagemgmt/lanmuxmgmt/add_lanmux« 

TextFile

#ident "@(#)add_lanmux	1.1, RC International, 90/10/29"

#menu# enable a LANMUX to access this load server
#help#
#help#  This procedure configures this server so that a LANMUX
#help#  can download from this machine.  It also adds various
#help#	directories and files used by the LANMUX.

groupname=lanmux

trap 'exit 0' 1 2 3 9 15
flags="-qq -k$$"
LMTYPES="RC911 RC912"

# Make sure that adapter env. has already been installed on the system.
if [ ! -s /usr/options/AE.name ] 
then
	/bin/echo "The Rc Adapter Environment has not been installed on your system."
	/bin/echo "Please use Sysadm to install the Rc Adapter Environment."
	exit 1
fi

while :
do
inst=`checkyn ${flags} -fe -H"
This procedure sets up a LANMUX environment
to allow it to download from this server" "
Do you wish to set up a LANMUX to use this load server?"`

[ "${inst}" = "n" ] && break

# Ask for lanmux id

loginid=`checkre ${flags} -fet -H"
The LANMUX UNIT ID is found on an label afixed to the
LANMUX unit. The format of the id is: lmXXXXXX or #XXXXXX,
where the XXXXXX is six unique characters for this LANMUX unit" \
"Enter the LANMUX UNIT ID: XXXXXX [?, q]" '^[0-9a-fA-F]\{6\}$' -o '^lm[0-9a-fA-F]\{6\}$' \
"Answer is not XXXXXX or lmXXXXXX" |
tr '[A-F]' '[a-f]' | sed -e '/^lm/!s/\(.*\)/lm\1/p'`

# Make sure that the user doesn't exists

if  grep "^${loginid}:" /etc/passwd >/dev/null 2>&1
then
	echo "\\tLANMUX UNIT ID '${loginid}' already exists."
	continue
fi

lmtype=`checklist ${flags} -fetp -H"
RC911 is a LANMUX with 8 serial ports. RC912 is a LANMUX with 4 serial
ports and 2 parallel printer ports." -D "RC911" "
Enter type of LANMUX (default: RC911) [RC911, RC912, q, ?]" $LMTYPES`

username="${lmtype} Lanmux ${loginid}"

logdir="/usr/${loginid}"

if [ -n "`ls -d ${logdir} 2>/dev/null`" ]
then
	echo "A file or directory allready exits with the name ${logdir}"
	continue
fi

# Sort 3rd field in /etc/passwd then cut 3rd field
# from last line.  Increment this field by 1 to
# come up with a unique new user ID number.

userid=`sort -t: +2n /etc/passwd  |  tail -1  |
	cut -d: -f3`
userid=`expr ${userid} + 1`

LMFILES="CSPTERM.POF CSPPRINT.POF CSPGW.POF MONITOR.POF LANMUX.CONF CSPTERM.CST"

# don't allow user ID numbers less than minid
if [ ${userid} -lt 100 ]
then
	userid=100
fi

groupid=`grep "^${groupname}:" /etc/group  |  cut -d: -f3`
if [ -z "${groupid}" ]
then
	echo "\\tThe ${groupname} is not a known group name."
	for groupname in sys root bin other
	do
		groupid=`grep "^${groupname}:" /etc/group  |  cut -d: -f3`
		test -n "${groupid}" && break
	done
	echo "\\t${groupname} is chosen"
fi

nsh=/etc/rci.d/nologin
export loginid userid groupid username logdir nsh LMFILES
/bin/sh -c '
	trap "" 1 2 3 15
	set -e
	passmgmt -a -c "${username}" -h ${logdir} -g ${groupid} -u ${userid} -s ${nsh} ${loginid}
	passwd -d -n 2 -x 1 ${loginid}
	umask 002
	mkdir ${logdir}
	cd ${logdir}
	chgrp ${groupid} .
	chown ${userid} .
	cd /usr/cards/lanmux
	ln ${LMFILES} ${logdir}
	ln LANMUX.IMG ${logdir}/S911.IMG
	cp cspgw.ed ${logdir}/CSPGW.CST
	echo "LANMUX UNIT ${loginid} installed."
	exit 0
'  ||  {
	admerr $0 'Failure in attempting to install new LANMUX UNIT.'
	[ -d ${logdir} ] && rm -rf ${logdir}
	exit 1
}
done