#!/bin/sh
# add_modem shell script. Must be run as root from bourne shell
# Change these parameters as needed for your particular needs.
#
# PARAMETER                MEANING
# ---------                -------
# PORT                     Port you want to set up. "a" or "b"
# TTYSPEED                 Speed setting, from /etc/ttydefs
# LOGINMSG                 The login message which will be displayed.
# -p zsmon                 PMTAG, name of this port monitor
# -s ttya                  SVCTAG, modem is on ttya. you may want ttyb
# -d /dev/term/$PORT       Actual port device.
# -l contty5H              Ttylabel, defined in /etc/ttydefs file. (speed
#                          setting. contty5H=19200 baud)
# -b                       Flag for bidirectional port use
# -S n                     Turn software carrier off (modem supplies
#                          hardware carrier detect signal)
# "dial in/out on serial port" This is a comment you'll see on pmadm -l
########################################################################
LOGINMSG="`hostname` ttyb login:"
# set PORT = either a or b
PORT="b"
#----------------------------------------
# choose your speed setting. See /etc/ttydefs for more, or build your
# own from the examples in the rest of this article.
#      contty5H = 19200bps, 7 bits even parity, as supplied by Sun
#      conttyH =   9600bps, 7 bits even parity, as supplied by Sun
TTYSPEED="contty6H"
#----------------------------------------
# change ownership of outgoing side of port to user uucp, group tty.
# change ownership of incoming side of port to user root, group tty.
#chown uucp /dev/cua/$PORT; chgrp tty /dev/cua/$PORT
#chown root /dev/term/$PORT; chgrp tty /dev/term/$PORT
#----------------------------------------
# Remove any existing port monitor on this port.
# You can ignore any error messages from this next command.
# If you see the message "Invalid request, ttya does not exist under zsmon",
# You may be trying to remove a port monitor which does not exist.
/usr/sbin/pmadm -r -p zsmon -s tty$PORT
#----------------------------------------
# Create the new port monitor
/usr/sbin/pmadm -a -p zsmon -s tty$PORT -i root \
-v `/usr/sbin/ttyadm -V` -fu -m "`/usr/sbin/ttyadm -T vt100 \
-p "$LOGINMSG" -d /dev/term/$PORT -s /usr/bin/login -l $TTYSPEED -b \
-S n -m ldterm,ttcompat`" -y "dial in/out on serial port"
############ end of add_modem script ###################################
