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

Unified Diff: src/scripts/build_gpt.sh

Issue 1521012: Add a --to option to build_image (Closed)
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/scripts/build_image » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/build_gpt.sh
diff --git a/src/scripts/build_gpt.sh b/src/scripts/build_gpt.sh
index d9346202f014290c236f2115f389da71be4dc620..02be98c2ba2ff052281ba948ac2d6f3a0efa8e20 100755
--- a/src/scripts/build_gpt.sh
+++ b/src/scripts/build_gpt.sh
@@ -144,15 +144,22 @@ install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE
# Emit helpful scripts for testers, etc.
${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}"
+sudo=
+if [ ! -w "$OUTDEV" ] ; then
adlr 2010/04/01 22:47:07 maybe [ -b "$OUTDEV" ] is better? -b means "it is
+ # use sudo when writing to a block device.
+ sudo=sudo
+fi
+
# Now populate the partitions.
echo "Copying stateful partition..."
-dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_STATEFUL}
+$sudo dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 \
+ seek=${START_STATEFUL}
echo "Copying kernel..."
-dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A}
-
+$sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A}
+
echo "Copying rootfs..."
-dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A}
+$sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A}
# Clean up temporary files.
if [[ -n "${MBR_IMG:-}" ]]; then
« no previous file with comments | « no previous file | src/scripts/build_image » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698