| # Copyright 2013 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Check if root disk firmware needs updating" | |
| author "chromium-os-dev@chromium.org" | |
| # Once partitions are initialized, check if the disk firmware needs updating. | |
| # To prevent reading the firmware rule, looking at the disk, a file is saved | |
| # at the end of a successful check/update. Look at this file first. | |
| # | |
| # Some SSD needs to be power cycled, be sure powerd is present to be able | |
| # to do a suspend/resume in the update script. | |
| start on started powerd | |
| task | |
| script | |
| # Check if we have to run. | |
| STATUS_FILE="/mnt/stateful_partition/unencrypted/cache/.disk_firmware_upgrade_completed" | |
| RULE_FILE="/opt/google/disk/firmware/rules" | |
| # If a previous upgrade worked fine skip this code. | |
| if [ -s "${STATUS_FILE}" ]; then | |
| exit 0 | |
| fi | |
| # Log can be found in /var/log/messages. | |
| chromeos-disk-firmware-update.sh \ | |
| --status "${STATUS_FILE}" \ | |
| --fw_package_dir "${RULE_FILE%/*}" || : | |
| end script |