summaryrefslogtreecommitdiff
path: root/scripts/image_signing/ensure_update_verification.sh
blob: c72b0f6efbc8e201165556da36033037f5e198fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

# Copyright (c) 2012 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.

# Verify that update payload verification is enabled.

# Abort on error.
set -e

# Load common constants and variables.
. "$(dirname "$0")/common.sh"

usage() {
  echo "Usage: $PROG image"
}

main() {
  if [ $# -ne 1 ]; then
    usage
    exit 1
  fi

  local image=$1
  local loopdev=$(loopback_partscan "${image}")
  local rootfs=$(make_temp_dir)
  local key_location="/usr/share/update_engine/update-payload-key.pub.pem"
  mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}"
  if [ ! -e "$rootfs/$key_location" ]; then
    die "Update payload verification key not found at $key_location"
  fi
}

main "$@"