| # Copyright (c) 2012 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 "Start the Chromium OS power daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| # Note, the 'start on' line is modified by chromeos-factoryinstall ebuild. |
| # Please do not change it without also changing that reference. |
| start on started boot-services |
| stop on stopping boot-services |
| expect fork |
| respawn |
| respawn limit 3 10 # if the job respawns 3 times in 10 seconds, stop trying. |
| |
| env LOG_DIR=/var/log/power_manager |
| env POWER_RUN_DIR=/run/power_manager/power |
| env PREFS_DIR=/var/lib/power_manager |
| env ROOT_RUN_DIR=/run/power_manager/root |
| env ROOT_SPOOL_DIR=/var/spool/power_manager/root |
| env VPD_CACHE_FILE=/mnt/stateful_partition/unencrypted/cache/vpd/filtered.txt |
| env MAX_NITS_PREF=internal_backlight_max_nits |
| env PM_TEST_DELAY_FILE=/sys/power/pm_test_delay |
| |
| # Add modules here in --vmodule format for debugging. |
| env VMODULE_ARG= |
| env UPSTART_RUN=1 |
| |
| pre-start script |
| exec /usr/share/cros/init/powerd-pre-start.sh |
| end script |
| |
| # Grant the following capabilities to powerd: |
| # CAP_WAKE_ALARM - Required by powerd to set wake up alarms for the instance. |
| # |
| # The -B 0x3 flag instructs Minijail to skip setting and locking the |
| # SECURE_NOROOT securebit. This allows powerd_setuid_helper, which is forked and |
| # exec'ed from powerd, to run as (root:power) with all effective capabilities |
| # after it calls setuid(2). |
| exec minijail0 -u power -c 0x800000000 --ambient -g power -B 0x3 -G -i -- \ |
| /usr/bin/powerd \ |
| --log_dir=${LOG_DIR} \ |
| --run_dir=${POWER_RUN_DIR} \ |
| --vmodule="${VMODULE_ARG}" \ |
| >/var/log/powerd.out 2>&1 |