1#!/bin/bash 2 3# Copyright 2012 The ChromiumOS Authors 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 27 local loopdev rootfs 28 if [[ -d "${image}" ]]; then 29 rootfs="${image}" 30 else 31 rootfs=$(make_temp_dir) 32 loopdev=$(loopback_partscan "${image}") 33 mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}" 34 fi 35 local key_location="/usr/share/update_engine/update-payload-key.pub.pem" 36 if [ ! -e "$rootfs/$key_location" ]; then 37 die "Update payload verification key not found at $key_location" 38 fi 39} 40 41main "$@" 42