kernel/atkbdc: Fix a prototype.
[dragonfly.git] / etc / rc.d / ppp-user
blobb8eab95000bcd82a17b4c8b572af1697e35edaac
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/ppp-user,v 1.4 2003/04/18 17:55:05 mtm Exp $
6 # PROVIDE: ppp-user
7 # REQUIRE: netif
9 . /etc/rc.subr
11 name="ppp"
12 rcvar="ppp_enable"
13 start_cmd="ppp_start"
14 stop_cmd="ppp_stop"
16 ppp_start()
18 local _punct_c _punct _ppp_unit
19 _profile=${ppp_profile}
21 _punct=". - / +"
22 for _punct_c in $_punct; do
23 _profile=`ltr ${_profile} ${_punct_c} '_'`
24 done
26 # Establish ppp mode.
28 if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
29 -a "${ppp_mode}" != "dedicated" \
30 -a "${ppp_mode}" != "background" ]; then
31 ppp_mode="auto"
34 ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
36 # Switch on NAT mode?
38 case ${ppp_nat} in
39 [Yy][Ee][Ss])
40 ppp_command="${ppp_command} -nat"
42 esac
44 # Check whether we are asked to use a specific unit
46 eval _ppp_unit=\$ppp_${_profile}_unit
47 if [ -n "${_ppp_unit}" ]; then
48 ppp_command="${ppp_command} -unit${_ppp_unit}"
51 ppp_command="${ppp_command} ${ppp_profile}"
53 echo "Starting ppp as \"${ppp_user}\""
54 su -m ${ppp_user} -c "exec ${ppp_command}"
57 ppp_stop()
59 pids=`check_process /usr/sbin/ppp`
60 if [ -n "${pids}" ]; then
61 for pid in ${pids}; do
62 kill -TERM ${pid}
63 done
64 wait_for_pids ${pids}
68 load_rc_config $name
69 run_rc_command "$1"