| # Copyright 2020 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Start qc-netmgr server" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started rmtfs |
| stop on stopping rmtfs |
| |
| # This service keeps the modem data connection alive. It can be killed, |
| # at the cost of an interruption in LTE connectivity. |
| oom score -100 |
| respawn |
| |
| expect fork |
| |
| # TODO(evgreen): Patch qc-netmgr to retry its connection, then delete this. |
| pre-start script |
| check_service() { |
| local timeout=60 |
| while [ "${timeout}" -gt 0 ]; do |
| if qrtr-lookup | grep -q "$1"; then |
| break |
| fi |
| |
| sleep 1 |
| : $(( timeout -= 1 )) |
| done |
| |
| if [ "${timeout}" = 0 ]; then |
| logger -t "${UPSTART_JOB}" "$1 didn't start." |
| exit 1 |
| fi |
| } |
| |
| # Don't wait for a modem service on wifi SKUs. |
| if grep -q /modem-nolte/ \ |
| /sys/firmware/devicetree/base/soc@0/remoteproc*/firmware-name; then |
| |
| logger -t "${UPSTART_JOB}" "Skipping WDS check for wifi SKU." |
| stop; exit 0 |
| fi |
| |
| check_service "Wireless Data Service" |
| end script |
| |
| # mmdata_mgr needs CAP_NET_ADMIN to open AF_QIPCRTR socket. |
| # TODO(evgreen): Put back proper sandboxing: |
| # -S /usr/share/policy/qc-netmgr-seccomp.policy \ |
| |
| exec minijail0 --profile=minimalistic-mountns -inNlpvr --uts \ |
| -c cap_net_admin=e -u nobody -g nobody \ |
| -- /usr/bin/mmdata_mgr |