Merge pull request #17303 from CarlosDerSeher/feature_bt_agent
[feed/packages.git] / net / modemmanager / files / modemmanager.init
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 stop_service() {
10 # Load common utils
11 . /usr/share/ModemManager/modemmanager.common
12 # Set all configured interfaces as unavailable
13 mm_cleanup_interfaces
14 }
15
16 start_service() {
17 # Setup ModemManager service
18 #
19 # We will make sure that the rundir always exists, and we initially cleanup
20 # all interfaces flagging them as unavailable.
21 #
22 # The cached events processing will wait for MM to be available in DBus
23 # and will make sure all ports are re-notified to ModemManager every time
24 # it starts.
25 #
26 # All these commands need to be executed on every MM start, even after
27 # procd-triggered respawns, which is why this is wrapped in a startup
28 # wrapper script called '/usr/sbin/ModemManager-wrapper'.
29 #
30 . /usr/share/ModemManager/modemmanager.common
31 procd_open_instance
32 procd_set_param command /usr/sbin/ModemManager-wrapper
33 procd_append_param command --log-level="$LOG_LEVEL"
34 [ "$LOG_LEVEL" = "DEBUG" ] && procd_append_param command --debug
35 procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
36 procd_set_param pidfile "${MODEMMANAGER_PID_FILE}"
37 procd_close_instance
38 }