blob: 2c27958290181afc72a520034ed4270c5fbe3853 [file] [log] [blame] [edit]
# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Daemon for managing scanners via SANE"
author "chromium-os-dev@chromium.org"
# Lorgnette can recover by restarting.
oom score -100
expect fork
console none
# This daemon is started by D-Bus service activation configured in
# dbus_service/org.chromium.lorgnette.service.
stop on stopping ui
pre-start script
# Check if ui is still running before starting lorgnette.
# 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
# Run this here instead of a tmpfiles clause because we want to also
# pass --clean.
systemd-tmpfiles --create --remove --clean /usr/lib/tmpfiles.d/lorgnette.conf
end script
exec syslog-cat --identifier="${UPSTART_JOB}" -- \
minijail0 --config /usr/share/minijail/lorgnette.conf \
-- /usr/bin/lorgnette
# Wait for daemon to claim its D-Bus name before transitioning to started.
post-start exec minijail0 -u saned -g scanner /usr/bin/gdbus \
wait --system --timeout 15 org.chromium.lorgnette