modemmanager: moving the openwrt related files to subdirectories
[feed/packages.git] / net / modemmanager / files / etc / init.d / modemmanager
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
3
4 USE_PROCD=1
5 START=70
6
7 LOG_LEVEL="INFO"
8
9 start_service() {
10 # Setup ModemManager service
11 #
12 # We will make sure that the rundir always exists, and we initially cleanup
13 # all interfaces flagging them as unavailable.
14 #
15 # The cached events processing will wait for MM to be available in DBus
16 # and will make sure all ports are re-notified to ModemManager every time
17 # it starts.
18 #
19 # All these commands need to be executed on every MM start, even after
20 # procd-triggered respawns, which is why this is wrapped in a startup
21 # wrapper script called '/usr/sbin/ModemManager-wrapper'.
22 #
23 . /usr/share/ModemManager/modemmanager.common
24 procd_open_instance "service"
25 procd_set_param command /usr/sbin/ModemManager-wrapper
26 procd_append_param command --log-level="$LOG_LEVEL"
27 [ "$LOG_LEVEL" = "DEBUG" ] && procd_append_param command --debug
28 procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
29 procd_set_param pidfile "${MODEMMANAGER_PID_FILE}"
30 procd_close_instance
31 procd_open_instance "monitor"
32 procd_set_param command /usr/sbin/ModemManager-monitor
33 procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
34 procd_close_instance
35 }