blob: f81e73f5d683a8cabdacc0d8a873f2df40cc0d2d [file] [log] [blame] [edit]
# 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 "Start camera algorithm service"
author "chromium-os-dev@chromium.org"
start on started system-services
stop on stopping system-services
# Make the camera jobs killable, because if it has a leak it's better to restart
# it than to OOM-panic.
oom score 0
expect fork
respawn
respawn limit 10 5
env SECCOMP_POLICY_FILE=/usr/share/policy/cros-camera-algo-seccomp.policy
env CAMERA_LIBFS_PATH=/usr/share/cros-camera/libfs
pre-start script
set -x
# Run the board-specific setup hooks, if any.
sh /etc/camera/setup-hooks-algo.sh || true
end script
post-start script
# Run the board-specific hooks, if any.
sh /etc/camera/post-start-hooks-algo.sh || true
end script
script
# Start constructing minijail0 args...
args=""
# Use Minijail config file.
args="$args --config /usr/share/minijail/cros-camera-algo.conf"
# Bind mount camera libraries.
args="$args -b ${CAMERA_LIBFS_PATH}"
# Drop privileges and set seccomp filter.
args="$args -n -S ${SECCOMP_POLICY_FILE}"
args="$args -- /usr/bin/cros_camera_algo"
exec minijail0 $args
end script