blob: 87dd664a29e354c8448d8c7ccc2474c06f0851fa [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=/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.
dump_vpd_log --full --stdout > "${UI_MACHINE_INFO_FILE}"
# 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