#!/bin/sh
# General PAP login script to use with mgetty
# Edit /etc/mgetty+sendfax/login.config and change the /AutoPPP/ line
# line this
# /AutoPPP/ - a_ppp /etc/ppp/paplogin
# Copy this file in /etc/ppp/paplogin and edit the DNSIP definition below

# You must provide the IP of the DNS, not its name
# pppd won't do a lookup all by itself.
DNSIP=1.2.3.4


# Check out the quotes on the next two lines.
# They are back quote, not normal quote. Very important!!!
TTY=`tty`
TTY=`basename $TTY`

if [ -f /etc/ppp/options.$TTY ] ; then
	# Assume that the IP configuration for the PPP session is stored
	# in /etc/ppp/options.tty
	exec /usr/sbin/pppd -detach auth -chap +pap login \
		crtscts modem lock \
		dns-addr $DNSIP
else
	# Allocate the IP from the tty name, using DNS lookup
	# this is the nicest solution. No /etc/ppp/options.tty needed
	exec /usr/sbin/pppd -detach auth -chap +pap login \
		crtscts modem lock \
		loghost:$TTY \
		dns-addr $DNSIP
fi
