| # 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 "Data Leak Prevention daemon" | |
| author "chromium-os-dev@chromium.org" | |
| # The service is started by Chrome on demand. | |
| stop on stopping ui | |
| respawn | |
| respawn limit 3 10 | |
| # Do not respawn if the service is terminated on purpose. | |
| normal exit 0 | |
| # Sacrifice before OOM panic. | |
| oom score 0 | |
| # TODO (poromov) Add virtual memory size limit after | |
| # run-time analysis. | |
| # Minijail actually forks off the desired process. | |
| expect fork | |
| pre-start script | |
| # Check if ui is still running before starting the daemon. | |
| # This is to prevent new dbus-activated instances from getting started once | |
| # the system is beginning to shut down. | |
| if ! initctl status ui | grep -q running; then | |
| stop | |
| exit 0 | |
| fi | |
| end script | |
| exec /usr/sbin/dlp_init | |
| # Wait for daemon to claim its D-Bus name before transitioning to started. | |
| post-start exec minijail0 -u dlp -g dlp /usr/bin/gdbus \ | |
| wait --system --timeout 15 org.chromium.Dlp | |
| post-stop exec logger -t "${UPSTART_JOB}" "Post-stop dlp" |