blob: 50c362f4377547932c151004eec65e0162a565f8 [file] [log] [blame]
# Copyright 2014 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 "Mojo IPC service registrar and matchmaking daemon."
author "chromium-os-dev@chromium.org"
# Stop conditions for this job deliberately omitted: clients
# may terminate with crashes when mojo_shell terminates before
# them. Ordering process termination with upstart is hard, so we
# simply leave mojo_shell running to ensure the rest of the system
# can shut down cleanly.
# mojo_shell is, for systems using mojo IPC, analogous to dbus-daemon, so the
# two jobs have the same start up requirements.
start on starting boot-services
respawn
env MOJO_SOCKET_DIR=/var/run/mojo
# Sets up the mojo_shell environment.
pre-start script
mkdir -p "${MOJO_SOCKET_DIR}"
chown mojo:mojo "${MOJO_SOCKET_DIR}"
chmod 0755 "${MOJO_SOCKET_DIR}"
end script
exec minijail0 -u mojo -g mojo /usr/sbin/mojo_shell \
--enable-external-applications="${MOJO_SOCKET_DIR}"/system_socket \
--origin=file:///usr/lib/mojo
# The post-stop script will clean up after mojo_shell. It's better to
# put this here rather than in pre-start since post-stop is always
# guaranteed to run while pre-start can exit pre-maturely.
post-stop script
rm -rf "${MOJO_SOCKET_DIR}"
end script