blob: c6f0a55a7df1eefbc2e595ad99da33182d6983bb [file] [log] [blame]
# Copyright 2018 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 "Chrome OS Machine Learning service"
author "chromium-os-dev@chromium.org"
# This daemon is started by D-Bus service activation configured in
# ml/dbus/org.chromium.MachineLearning.service.
stop on stopping system-services
expect fork
pre-start script
mkdir -m 0755 -p /var/lib/ml_service/metrics
chown -R ml-service:ml-service /var/lib/ml_service
# Check if system-services is still running before starting ml-service.
# This is to prevent new dbus-activated instances from getting started once
# the system is beginning to shut down.
if ! initctl status system-services | grep -q running; then
stop
exit 0
fi
end script
# --profile=minimalistic-mountns Mount namespace with basic mounts
# includes /var/empty, /, /proc (RO), /dev/log, /tmp (tmpfs)
# -b /var/lib/ml_service for ml_service metrics
# -b /var/lib/metrics for uma metrics
exec minijail0 -e -i -n -p -l --uts -v -Kslave -c 0 \
--profile=minimalistic-mountns \
-k tmpfs,/var,tmpfs \
-k tmpfs,/run,tmpfs \
-b /run/dbus \
-b /run/imageloader \
-b /var/lib/ml_service,,1 \
-b /var/lib/metrics,,1 \
-S /usr/share/policy/ml_service-seccomp.policy \
-u ml-service -g ml-service -- /usr/bin/ml_service
# Wait for daemon to claim its D-Bus name before transitioning to started.
post-start exec minijail0 -u ml-service -g ml-service /usr/bin/gdbus \
wait --system --timeout 15 org.chromium.MachineLearning