blob: c283a6d2dc7d72e3254c4de0f509129caddd8ba1 [file] [log] [blame]
# 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 "Collect machine information for session_manager"
author "chromium-os-dev@chromium.org"
# This job collects machine information and places it in a file. It is
# then pushed to session_manager by ui-init-late.
# Start after the system is mostly up and running, which also implies
# that the VPD has been read and the udev database is fully initialized.
start on started system-services
env UI_MACHINE_INFO_FILE=/var/run/session_manager/machine-info
script
(
# Just continue if one of the commands below fails.
set +e
# Grab full VPD data from dump_vpd_log, which contains the machine
# serial number and echo group code.
#
# TODO(mnissler): As things stand, dump_vpd_log prints error
# messages on stdout in some situations, so only emit its output on
# clean termination. Simplify this after http://crbug.com/369188 is
# fixed.
VPD_DATA=$(dump_vpd_log --full --stdout)
[ $? -eq 0 ] && echo "${VPD_DATA}"
# Grab the disk serial number from the udev database.
ROOTDEV=$(rootdev -s -d || true)
udevadm info --query=property --name="${ROOTDEV}" |
awk -F = '/^ID_SERIAL=/ { print "root_disk_serial_number=" $2 }'
) > "${UI_MACHINE_INFO_FILE}"
end script