| # Copyright 2021 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 "Chrome OS RMA service" |
| author "chromium-os-dev@chromium.org" |
| |
| # This daemon is started by D-Bus service activation configured in |
| # dbus/org.chromium.Rmad.service. |
| stop on stopping system-services |
| |
| # Make it killable. |
| oom score -100 |
| # Let the daemon crash if it grows too much. "as" for "address space". |
| # TODO(chenghan): Check memory usage after some development. Currently set |
| # to 100 MB. |
| limit as 100000000 unlimited |
| |
| env POWERWASH_REQUEST_FILE=/var/lib/rmad/.powerwash_request |
| env CUTOFF_REQUEST_FILE=/var/lib/rmad/.battery_cutoff_request |
| |
| exec /usr/sbin/rmad |
| |
| pre-stop script |
| if [ -e "${POWERWASH_REQUEST_FILE}" ]; then |
| rm "${POWERWASH_REQUEST_FILE}" |
| echo "fast safe keepimg rma" > /mnt/stateful_partition/factory_install_reset |
| fi |
| if [ -e "${CUTOFF_REQUEST_FILE}" ]; then |
| rm "${CUTOFF_REQUEST_FILE}" |
| crossystem battery_cutoff_request=1 |
| fi |
| end script |