| # Copyright 2022 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 the disc control daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| oom score -100 |
| |
| start on started boot-services |
| stop on stopping boot-services |
| |
| respawn |
| |
| pre-start script |
| setup_sysfs_acls() { |
| local root_drive="$(rootdev -s -d)" |
| local drive_name="$(basename ${root_drive})" |
| local device_node="$(readlink -f /sys/block/${drive_name})" |
| |
| if [ ! -d "${device_node}/device/unit_descriptor" ]; then |
| exit 0 |
| fi |
| |
| # Device node is <controller_node>/host*/target*/*/block/<drive_name> |
| local controller_node=${device_node}/../../../../../ |
| wb_node=${controller_node}/wb_on |
| |
| chown disco:disco ${wb_node} # croslint: disable |
| } |
| |
| setup_sysfs_acls |
| end script |
| |
| exec minijail0 --config /usr/share/minijail/discod.conf \ |
| -- /usr/sbin/discod --log_level=-1 |
| |
| post-start exec minijail0 -u disco -g disco /usr/bin/gdbus \ |
| wait --system --timeout 15 org.chromium.Discod |