6 # PROVIDE: rfcomm_pppd_server
13 name="rfcomm_pppd_server"
14 desc="RFCOMM PPP daemon"
15 rcvar="rfcomm_pppd_server_enable"
16 command="/usr/sbin/rfcomm_pppd"
17 start_cmd="rfcomm_pppd_server_start"
18 stop_cmd="rfcomm_pppd_server_stop"
19 required_modules="ng_btsocket"
21 rfcomm_pppd_server_start_profile()
23 local _profile _profile_cleaned _punct _punct_c
24 local _bdaddr _channel _x
30 for _punct_c in ${_punct} ; do
31 _profile_cleaned=`ltr ${_profile_cleaned} ${_punct_c} '_'`
36 # Check for RFCOMM PPP profile bdaddr override
38 eval _bdaddr=\$rfcomm_pppd_server_${_profile_cleaned}_bdaddr
39 if [ -n "${_bdaddr}" ]; then
40 rc_flags="${rc_flags} -a ${_bdaddr}"
43 # Check for RFCOMM PPP profile channel override
45 eval _channel=\$rfcomm_pppd_server_${_profile_cleaned}_channel
46 if [ -z "${_channel}" ]; then
49 rc_flags="${rc_flags} -C ${_channel}"
51 # Check for RFCOMM PPP profile register SP override
53 eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_sp
54 if [ -n "${_x}" ]; then
55 if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_sp" ; then
56 rc_flags="${rc_flags} -S"
60 # Check for RFCOMM PPP profile register DUN override
62 eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_dun
63 if [ -n "${_x}" ]; then
64 if checkyesno "rfcomm_pppd_server_${_profile_cleaned}_register_dun" ; then
65 rc_flags="${rc_flags} -D"
71 $command -s ${rc_flags} -l ${_profile}
74 rfcomm_pppd_server_stop_profile()
80 /bin/pkill -f "^${command}.*[[:space:]]${_profile}\$" || \
81 echo -n "(not running)"
84 rfcomm_pppd_server_start()
89 if [ -z "${_profile}" ]; then
90 _profile=${rfcomm_pppd_server_profile}
93 echo -n "Starting RFCOMM PPP profile:"
95 for _p in ${_profile} ; do
97 rfcomm_pppd_server_start_profile ${_p}
103 rfcomm_pppd_server_stop()
108 if [ -z "${_profile}" ]; then
109 _profile=${rfcomm_pppd_server_profile}
112 echo -n "Stopping RFCOMM PPP profile:"
114 for _p in ${_profile} ; do
116 rfcomm_pppd_server_stop_profile ${_p}