blob: 5b397a0819ce69b2969e172c9fd30d2044f6098a [file] [log] [blame]
#!/bin/sh
# Copyright (c) 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.
TRIES="$(crossystem fwupdate_tries || echo 0)"
# FIRMWARE_UPDATE_LOGS will be collected by update-engine.
FIRMWARE_UPDATE_LOGS=/mnt/stateful_partition/update_firmware.log
FIRMWARE_UPDATE_SCRIPT=/usr/sbin/chromeos-firmwareupdate
if [ "$(crossystem mainfw_type)" = developer ]; then
TRIES=0 # Prevents updates if we're in developer mode
chromeos-boot-alert dev_fwcheck
fi
[ "${TRIES}" -gt 0 ] || exit 0
# Decrease update counter
crossystem fwupdate_tries=$((TRIES - 1))
chromeos-boot-alert update_firmware
(date && "${FIRMWARE_UPDATE_SCRIPT}" --mode=startup 2>&1) |
tee -a ${FIRMWARE_UPDATE_LOGS}