blob: 5c636e5f0d759bfd8f38200b82d8c26c1dc4dd94 [file] [log] [blame]
# Copyright 2020 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 "Daemon for managing scanners via SANE"
author "chromium-os-dev@chromium.org"
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
end script
exec minijail0 -ilnprv --uts --mount-dev \
-u saned -g scanner -G \
-P /mnt/empty \
-b / \
-b /proc \
-b /sys \
-b /dev/log \
-b /dev/bus/usb \
-k 'run,/run,tmpfs,MS_NOSUID|MS_NODEV|MS_NOEXEC' \
-b /run/systemd/journal \
-b /run/dbus \
-b /run/ippusb,/run/ippusb,1 \
-k 'var,/var,tmpfs,MS_NOSUID|MS_NODEV|MS_NOEXEC' \
-b /var/lib/metrics,/var/lib/metrics,1 \
-- /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