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

Side by Side Diff: src/scripts/emit_gpt_scripts.sh

Issue 1747005: Only search for the gpt tool if we need it. (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « src/platform/installer/chromeos-common.sh ('k') | no next file » | 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 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 # 5 #
6 # Emit scripts to pack and unpack the partitions from a GPT disk image. 6 # Emit scripts to pack and unpack the partitions from a GPT disk image.
7 7
8 # Load common constants. This should be the first executable line. 8 # Load common constants. This should be the first executable line.
9 # The path to common.sh should be relative to your script's location. 9 # The path to common.sh should be relative to your script's location.
10 . "$(dirname "$0")/common.sh" 10 . "$(dirname "$0")/common.sh"
11 . "$(dirname "$0")/chromeos-common.sh" 11 . "$(dirname "$0")/chromeos-common.sh"
12 12
13 set -e 13 set -e
14 14
15 # Usage 15 # Usage
16 IMAGE=${1:-} 16 IMAGE=${1:-}
17 DIR=${2:-} 17 DIR=${2:-}
18 if [[ -z "$IMAGE" || -z "$DIR" ]]; then 18 if [[ -z "$IMAGE" || -z "$DIR" ]]; then
19 echo "Usage: $0 GPT_DEVICE DIRECTORY" 1>&2 19 echo "Usage: $0 GPT_DEVICE DIRECTORY" 1>&2
20 exit 1 20 exit 1
21 fi 21 fi
22 22
23 PACK="${DIR}/pack_partitions.sh" 23 PACK="${DIR}/pack_partitions.sh"
24 UNPACK="${DIR}/unpack_partitions.sh" 24 UNPACK="${DIR}/unpack_partitions.sh"
25 25
26 locate_gpt
27
26 TMP=$(mktemp) 28 TMP=$(mktemp)
27 sudo $GPT -r show -l "$IMAGE" > $TMP 29 sudo $GPT -r show -l "$IMAGE" > $TMP
28 30
29 HEADER='#!/bin/sh -eu 31 HEADER='#!/bin/sh -eu
30 # File generated by emit_gpt_scripts.sh. Do not edit. 32 # File generated by emit_gpt_scripts.sh. Do not edit.
31 TARGET=${1:-} 33 TARGET=${1:-}
32 if [[ -z "$TARGET" ]]; then 34 if [[ -z "$TARGET" ]]; then
33 echo "Usage: $0 DEVICE" 1>&2 35 echo "Usage: $0 DEVICE" 1>&2
34 exit 1 36 exit 1
35 fi 37 fi
(...skipping 12 matching lines...) Expand all
48 echo "dd if=$loc of=$file bs=512 skip=$start count=$size" \ 50 echo "dd if=$loc of=$file bs=512 skip=$start count=$size" \
49 >> "$UNPACK" 51 >> "$UNPACK"
50 echo \ 52 echo \
51 "dd if=$file of=$loc bs=512 seek=$start count=$size conv=notrunc" \ 53 "dd if=$file of=$loc bs=512 seek=$start count=$size conv=notrunc" \
52 >> "$PACK" 54 >> "$PACK"
53 done 55 done
54 56
55 chmod +x "$PACK" "$UNPACK" 57 chmod +x "$PACK" "$UNPACK"
56 58
57 rm $TMP 59 rm $TMP
OLDNEW
« no previous file with comments | « src/platform/installer/chromeos-common.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698