| # Copyright 2019 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Daemon providing eSIM support" | |
| author "chromium-os-dev@chromium.org" | |
| env LOG_LEVEL=0 | |
| import LOG_LEVEL | |
| env ESIM_FW_PATH="/opt/google/gemalto/cosupdate.xml" | |
| import ESIM_FW_PATH | |
| start on started network-services | |
| stop on starting pre-shutdown | |
| expect fork | |
| oom score -100 | |
| respawn | |
| # if the job respawns 3 times in 10 seconds, stop trying. | |
| respawn limit 3 10 | |
| # Do not respawn if we exited on purpose (e.g. service disabled). | |
| normal exit 0 | |
| pre-start script | |
| if [ -f /var/cache/modem-utilities/log_hermes_debug ]; then | |
| LOG_LEVEL="-2" | |
| fi | |
| case "${LOG_LEVEL}" in | |
| -3|-2|-1|0|1|2) | |
| ;; | |
| *) | |
| logger -p err -t "${UPSTART_JOB}" "Unsupported log level: ${LOG_LEVEL}" | |
| exit 1 | |
| ;; | |
| esac | |
| mkdir -p /var/cache/hermes # croslint: disable | |
| chown modem:modem /var/cache/hermes # croslint: disable | |
| end script | |
| exec minijail0 \ | |
| --config /usr/share/minijail/hermes.conf \ | |
| /usr/bin/hermes \ | |
| --log_level="${LOG_LEVEL}" \ | |
| --fw_path="${ESIM_FW_PATH}" |