| # Copyright 2016 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. |
| |
| [Unit] |
| Description=Chrome OS user interface |
| PartOf=ui.target |
| After=ui.target |
| Before=boot-services.target |
| |
| # If an unplanned exit had taken place kick in the respawn logic. |
| OnFailure=ui-respawn.service |
| |
| [Service] |
| LimitNICE=40 |
| LimitRTPRIO=10 |
| TimeoutStopSec=20s |
| KillMode=control-group |
| Restart=on-success |
| |
| # Directory where session manager logs are written and prefix of files there. |
| Environment=UI_LOG_DIR=/var/log/ui |
| Environment=UI_LOG_FILE=ui.LATEST |
| |
| # Directory where session manager sets up container roots. |
| Environment=CONTAINER_ROOT_DIR=/run/containers |
| |
| # Directory for renderer freezer. |
| Environment=UI_FREEZER_CGROUP_DIR=/sys/fs/cgroup/freezer/ui |
| Environment=CHROME_FREEZER_CGROUP_DIR=/sys/fs/cgroup/freezer/ui/chrome_renderers |
| Environment=UI_CPU_CGROUP_DIR=/sys/fs/cgroup/cpu/ui |
| |
| # This may be used to wrap the Chrome executable within another command |
| # instead of calling it directly. The flag's value will be split on whitespace |
| # into an absolute path and arguments, after which session_manager will add |
| # Chrome's arguments. For example: |
| # |
| # env CHROME_COMMAND_FLAG="--chrome-command=/usr/local/bin/strace /opt/google/chrome/chrome" |
| Environment=CHROME_COMMAND_FLAG= |
| |
| ExecStartPre=/usr/share/cros/init/ui-pre-start |
| ExecStart=/bin/sh -c '/sbin/session_manager "${CHROME_COMMAND_FLAG}">"${UI_LOG_DIR}/${UI_LOG_FILE}" 2>&1' |
| ExecStartPost=/bin/sh -c "echo $(systemctl show -p MainPID ui | cut -f 2 -d '=')\ |
| > \"${UI_CPU_CGROUP_DIR}/tasks\"" |
| ExecStartPost=/bin/sh -c "echo $(systemctl show -p MainPID ui | cut -f 2 -d '=')\ |
| > \"${UI_FREEZER_CGROUP_DIR}/cgroup.procs\"" |
| ExecStopPost=/usr/share/cros/init/ui-post-stop |
| ExecStopPost=-/usr/bin/systemctl --no-block start logout.service |
| ExecStopPost=-/usr/bin/systemctl --no-block start shill-stop-user-session.service |
| |
| [Install] |
| WantedBy=ui.target |