Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: image_to_usb.sh

Issue 6685101: Allow file in --from arg (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mount_gpt_image.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to convert the output of build_image.sh to a usb image. 7 # Script to convert the output of build_image.sh to a usb image.
8 8
9 # --- BEGIN COMMON.SH BOILERPLATE --- 9 # --- BEGIN COMMON.SH BOILERPLATE ---
10 # Load common CrOS utilities. Inside the chroot this file is installed in 10 # Load common CrOS utilities. Inside the chroot this file is installed in
(...skipping 22 matching lines...) Expand all
33 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") 33 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")")
34 34
35 . "${INSTALLER_ROOT}/chromeos-common.sh" || \ 35 . "${INSTALLER_ROOT}/chromeos-common.sh" || \
36 die "Unable to load chromeos-common.sh" 36 die "Unable to load chromeos-common.sh"
37 37
38 get_default_board 38 get_default_board
39 39
40 # Flags 40 # Flags
41 DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built" 41 DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built"
42 DEFINE_string from "" \ 42 DEFINE_string from "" \
43 "Directory containing ${CHROMEOS_IMAGE_NAME}" 43 "Directory containing ${CHROMEOS_IMAGE_NAME}, or filename"
44 DEFINE_string to "/dev/sdX" "${DEFAULT_TO_HELP}" 44 DEFINE_string to "/dev/sdX" "${DEFAULT_TO_HELP}"
45 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts" "y" 45 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts" "y"
46 DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image" 46 DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image"
47 DEFINE_boolean force_non_usb ${FLAGS_FALSE} \ 47 DEFINE_boolean force_non_usb ${FLAGS_FALSE} \
48 "Write out image even if target (--to) doesn't look like a USB disk" 48 "Write out image even if target (--to) doesn't look like a USB disk"
49 DEFINE_boolean factory_install ${FLAGS_FALSE} \ 49 DEFINE_boolean factory_install ${FLAGS_FALSE} \
50 "Whether to generate a factory install shim." 50 "Whether to generate a factory install shim."
51 DEFINE_boolean factory ${FLAGS_FALSE} \ 51 DEFINE_boolean factory ${FLAGS_FALSE} \
52 "Whether to generate a factory runin image. Implies aututest and test" 52 "Whether to generate a factory runin image. Implies aututest and test"
53 DEFINE_boolean copy_kernel ${FLAGS_FALSE} \ 53 DEFINE_boolean copy_kernel ${FLAGS_FALSE} \
(...skipping 11 matching lines...) Expand all
65 FLAGS "$@" || exit 1 65 FLAGS "$@" || exit 1
66 eval set -- "${FLAGS_ARGV}" 66 eval set -- "${FLAGS_ARGV}"
67 67
68 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then 68 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
69 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then 69 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
70 echo "Factory test image is incompatible with factory install shim." 70 echo "Factory test image is incompatible with factory install shim."
71 exit 1 71 exit 1
72 fi 72 fi
73 fi 73 fi
74 74
75 # Allow --from /foo/file.bin
76 if [ -f "${FLAGS_from}" ]; then
77 pathname=$(dirname "${FLAGS_from}")
78 filename=$(basename "${FLAGS_from}")
79 FLAGS_image_name="${filename}"
80 FLAGS_from="${pathname}"
81 fi
82
83
75 # Require autotest for manucaturing image. 84 # Require autotest for manucaturing image.
76 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then 85 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
77 echo "Factory image requires --test_image, setting." 86 echo "Factory image requires --test_image, setting."
78 FLAGS_test_image=${FLAGS_TRUE} 87 FLAGS_test_image=${FLAGS_TRUE}
79 fi 88 fi
80 89
81 # Require test for for factory install shim. 90 # Require test for for factory install shim.
82 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then 91 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
83 echo "Factory install shim requires --test_image, setting." 92 echo "Factory install shim requires --test_image, setting."
84 FLAGS_test_image=${FLAGS_TRUE} 93 FLAGS_test_image=${FLAGS_TRUE}
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 echo "Done." 257 echo "Done."
249 else 258 else
250 # Output to a file, so just make a copy. 259 # Output to a file, so just make a copy.
251 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." 260 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
252 ${COMMON_PV_CAT} "${SRC_IMAGE}" >"${FLAGS_to}" 261 ${COMMON_PV_CAT} "${SRC_IMAGE}" >"${FLAGS_to}"
253 262
254 echo "Done. To copy to a USB drive, do something like:" 263 echo "Done. To copy to a USB drive, do something like:"
255 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M oflag=sync" 264 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M oflag=sync"
256 echo "where /dev/sdX is the entire drive." 265 echo "where /dev/sdX is the entire drive."
257 fi 266 fi
OLDNEW
« no previous file with comments | « no previous file | mount_gpt_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698