| # 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 -i -l -p -N -n -v -P /mnt/empty -b / -b /dev -b /proc \ |
| -k 'tmpfs,/run,tmpfs,MS_NOSUID|MS_NODEV|MS_NOEXEC' -b /run/dbus \ |
| -t -r \ |
| -S /usr/share/policy/midis-seccomp.policy \ |
| -c 0 -u midis -g midis -G -- /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 |