summaryrefslogtreecommitdiff
path: root/net/speedtouch/files/adsl.sh
blob: 02c7fcfaaf45c979c00cfe7e7a50f202142415a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: adsl.sh,v 1.4 2002/09/20 02:01:59 grant Exp $
#
# PROVIDE: adsl
# REQUIRE: ipnat
#
# On systems with rc.d you will need to copy this to /etc/rc.d and set
# 'adsl=YES' in /etc/rc.conf

adsl_start()
{
	echo "Starting speedtouch adsl."
	# Ensure we have at least tun0 - NetBSD 1.6 and later
	ifconfig tun0 >/dev/null 2>&1 || ifconfig tun0 create
	@PREFIX@/sbin/modem_run -f @PREFIX@/libdata/alcaudsl.sys -m
	@PREFIX@/sbin/ppp -ddial adsl
}

adsl_stop()
{
	PID=`ps ax | awk '/ppp -ddial adsl $/{print $1}'`
	if [ -n "$PID" ]; then
	    echo "Stopping speedtouch adsl."
	    kill $PID
	fi
}

if [ ! -d /etc/rc.d ]
then
	case "$1" in
	    start)	adsl_start		;;
	    stop)	adsl_stop		;;
	    rstart)	adsl_stop ; adsl_start	;;
	esac
	exit
fi

. /etc/rc.subr

name="adsl"
rcvar=$name
start_cmd="adsl_start"
stop_cmd="adsl_stop"

load_rc_config $name
run_rc_command "$1"