| # Copyright 2014 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 "Supplemental session_manager initialization after boot" |
| author "chromium-os-dev@chromium.org" |
| |
| # This job forwards machine information to session_manager over DBus. |
| # The data is used by session_manager eventually, but is not critical to |
| # starting the UI. |
| |
| # Machine information needs to be pushed to session_manager every time |
| # it starts. However, the data may not be available yet. In that case |
| # this job runs again after ui-collect-machine-info has collected the |
| # data. |
| start on login-prompt-visible or stopped ui-collect-machine-info |
| |
| env UI_MACHINE_INFO_FILE=/run/session_manager/machine-info |
| |
| script |
| # Bail out if data collection is still pending. |
| [ -e "${UI_MACHINE_INFO_FILE}" ] || exit 0 |
| |
| # Note the tr command below that fixes up the input data to only |
| # contain ASCII characters. Well-formed input should only contain |
| # ASCII characters anyways. However, there are devices in the wild |
| # that have random invalid binary data in their VPD. |
| # |
| # Sanitization is necessary here because dbus-send asserts the input |
| # string to be valid UTF-8. Without sanitization, these asserts |
| # generate crash reports for dbus-send and fail to forward potentially |
| # intact VPD contents. See also http://crbug.com/438166. |
| dbus-send --system --dest=org.chromium.SessionManager \ |
| --type=method_call /org/chromium/SessionManager \ |
| org.chromium.SessionManagerInterface.InitMachineInfo \ |
| string:"$(tr -cd '\1-\177' < "${UI_MACHINE_INFO_FILE}")" || |
| logger -t "${UPSTART_JOB}" \ |
| "Failed to pass machine info to session_manager!" |
| end script |