# 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.

updater_custom_main() {
  local locked_desc_fwid="Google_Zako.5219.27.0"

  debug_msg "Customization for ${TARGET_PLATFORM} loaded."

  # If updating RW FW from unlocked descriptor, flash descriptor region.
  if [ "$FLAGS_update_main" = "$FLAGS_TRUE" ]; then
    case "${FLAGS_mode}" in
      autoupdate | recovery )
        if cros_version_greater_than "$locked_desc_fwid" "$FWID"; then
          alert "Upgrading to locked SPI descriptor."
          crosfw_update_main "SI_DESC"
        fi
        ;;
    esac
  fi
}
