| # Copyright 2021 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "ChromeOS 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 boot-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 200 MB. | |
| limit as 200000000 unlimited | |
| pre-start script | |
| # Check if boot-services is still running before starting rmad. | |
| # This is to prevent new dbus-activated instances from getting started once | |
| # the system is beginning to shut down. | |
| # We check boot-services instead of system-services because rmad can start | |
| # very early and race with system-services. | |
| if ! initctl status boot-services | grep -q running; then | |
| stop | |
| exit 0 | |
| fi | |
| end script | |
| # rmad enters minijail in main.cc. | |
| exec /usr/sbin/rmad | |
| # Wait for daemon for claim its D-Bus name. | |
| post-start exec minijail0 -u rmad -g rmad /usr/bin/gdbus wait --system \ | |
| --timeout 15 org.chromium.Rmad |