| # 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 |
| expect fork |
| |
| 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 \ |
| -u disco \ |
| -g disco \ |
| --uts \ |
| -e \ |
| -l \ |
| -N \ |
| -p \ |
| --profile=minimalistic-mountns-nodev \ |
| -b /dev \ |
| -k 'tmpfs,/run,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \ |
| -b /run/dbus \ |
| -k 'tmpfs,/sys,tmpfs,MS_NODEV|MS_NOEXEC|MS_NOSUID,mode=755,size=10M' \ |
| -b /sys,,1 \ |
| -- /usr/sbin/discod --log_level=-1 |
| |
| post-start exec minijail0 -u disco -g disco /usr/bin/gdbus \ |
| wait --system --timeout 15 org.chromium.Discod |