1#!/bin/bash
2
3# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Verify that update payload verification is enabled.
8
9# Abort on error.
10set -e
11
12# Load common constants and variables.
13. "$(dirname "$0")/common.sh"
14
15usage() {
16  echo "Usage: $PROG image"
17}
18
19main() {
20  if [ $# -ne 1 ]; then
21    usage
22    exit 1
23  fi
24
25  local image=$1
26  local rootfs=$(make_temp_dir)
27  local key_location="/usr/share/update_engine/update-payload-key.pub.pem"
28  mount_image_partition_ro "$image" 3 "$rootfs"
29  if [ ! -e "$rootfs/$key_location" ]; then
30    die "Update payload verification key not found at $key_location"
31  fi
32}
33
34main "$@"
35