blob: 3990708c3768a8eacad4a695a2790b7629122d6c [file] [log] [blame]
# Copyright 2017 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 "Firmware updating task before UI"
author "chromium-os-dev@chromium.org"
start on starting ui
# This job blocks the start of UI and calls all the tasks sequentially at boot
# if the tasks:
# 1. Show up the boot message by calling `chromeos-boot-alert`.
# 2. Leave the message and enter Chrome UI normally after it is finished.
# Please make sure the tasks running here DO NOT take a long time in the no-op
# case because this job BLOCKS the UI startup.
# It has no main script so that it only runs once at boot before UI starts.
pre-start script
# Get the pid of frecon.
frecon_pid="$(pgrep frecon)"
# Update detachable keyboard firmware.
HAMMERD_SCRIPT='/usr/share/cros/init/hammerd-at-boot.sh'
if [ -e "${HAMMERD_SCRIPT}" ]; then
logger -t "${UPSTART_JOB}" "Update keyboard firmware."
"${HAMMERD_SCRIPT}"
fi
# Update touch firmware.
TOUCH_SCRIPT='/opt/google/touch/scripts/chromeos-touch-update.sh'
if [ -e "${TOUCH_SCRIPT}" ]; then
logger -t "${UPSTART_JOB}" "Update touch firmware."
"${TOUCH_SCRIPT}"
fi
# Restore frecon if chromeos-boot-alert was called.
if [ "${frecon_pid}" != "$(pgrep frecon)" ]; then
logger -t "${UPSTART_JOB}" "Restore frecon."
pkill -9 -f frecon
if is_developer_end_user; then
frecon --daemon --enable-osc --enable-vts --pre-create-vts
fi
fi
end script