| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 2010 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 | # abort on error |
| 8 | set -e |
| 9 | |
| 10 | # Load common constants and variables. |
| 11 | . "$(dirname "$0")/common.sh" |
| 12 | |
| 13 | main() { |
| 14 | if [[ $# -ne 1 ]]; then |
| 15 | echo "Usage $0 <image>" |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | local image="$1" |
| 20 | |
| 21 | local loopdev rootfs |
| 22 | if [[ -d "${image}" ]]; then |
| 23 | rootfs="${image}" |
| 24 | else |
| 25 | rootfs=$(make_temp_dir) |
| 26 | loopdev=$(loopback_partscan "${image}") |
| 27 | mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}" |
| 28 | fi |
| 29 | |
| 30 | if ! no_chronos_password "${rootfs}"; then |
| 31 | die "chronos password is set! Shouldn't be for release builds." |
| 32 | fi |
| 33 | } |
| 34 | main "$@" |