6 # PROVIDE: rfcomm_pppd_server
13 name="rfcomm_pppd_server"
14 rcvar="rfcomm_pppd_server_enable"
15 command="/usr/sbin/rfcomm_pppd"
16 start_cmd="rfcomm_pppd_server_start"
17 stop_cmd="rfcomm_pppd_server_stop"
18 required_modules="ng_btsocket"
20 rfcomm_pppd_server_start_profile()
22 local _profile _profile_cleaned _punct _punct_c
23 local _bdaddr _channel _x
29 for _punct_c in ${_punct} ; do
30 _profile_cleaned=`ltr ${_profile_cleaned} ${_punct_c} '_'`
35 # Check for RFCOMM PPP profile bdaddr override
37 eval _bdaddr=\$rfcomm_pppd_server_${_profile_cleaned}_bdaddr
38 if [ -n "${_bdaddr}" ]; then
39 rc_flags="${rc_flags} -a ${_bdaddr}"
42 # Check for RFCOMM PPP profile channel override
44 eval _channel=\$rfcomm_pppd_server_${_profile_cleaned}_channel
45 if [ -z "${_channel}" ]; then
48 rc_flags="${rc_flags} -C ${_channel}"
50 # Check for RFCOMM PPP profile register SP override
52 eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_sp
53 if [ -n "${_x}" ]; then
54 if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_sp" ; then
55 rc_flags="${rc_flags} -S"
59 # Check for RFCOMM PPP profile register DUN override
61 eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_dun
62 if [ -n "${_x}" ]; then
63 if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_dun" ; then
64 rc_flags="${rc_flags} -D"
70 $command -s ${rc_flags} -l ${_profile}
73 rfcomm_pppd_server_stop_profile()
79 /bin/pkill -f "^${command}.*[[:space:]]${_profile}\$" || \
80 echo -n "(not running)"
83 rfcomm_pppd_server_start()
88 if [ -z "${_profile}" ]; then
89 _profile=${rfcomm_pppd_server_profile}
92 echo -n "Starting RFCOMM PPP profile:"
94 for _p in ${_profile} ; do
96 rfcomm_pppd_server_start_profile ${_p}
102 rfcomm_pppd_server_stop()
107 if [ -z "${_profile}" ]; then
108 _profile=${rfcomm_pppd_server_profile}
111 echo -n "Stopping RFCOMM PPP profile:"
113 for _p in ${_profile} ; do
115 rfcomm_pppd_server_stop_profile ${_p}