| # Copyright 2017 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Chrome OS MIDI server" | |
| author "chromium-os-dev@chromium.org" | |
| stop on stopping ui | |
| respawn | |
| expect fork | |
| # Allow the MIDI server real time priority. | |
| limit rtprio 20 20 | |
| pre-start script | |
| # Check if ui is still running before starting MIDI server. | |
| # This is to prevent new dbus-activated instances from getting started once | |
| # the system is beginning to shut down. | |
| if ! initctl status ui | grep -q running; then | |
| stop | |
| exit 0 | |
| fi | |
| end script | |
| # Needs access to /dev to perform device enumeration. | |
| # Needs access to /run/dbus to connect to D-Bus. | |
| exec minijail0 --config /usr/share/minijail/midis.conf \ | |
| -S /usr/share/policy/midis-seccomp.policy \ | |
| -- /usr/bin/midis | |
| # Wait for daemon to claim its D-Bus name before transitioning to started. | |
| post-start exec minijail0 -u midis -g midis /usr/bin/gdbus \ | |
| wait --system --timeout 15 org.chromium.Midis |