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

Side by Side Diff: emit_gpt_scripts.sh

Issue 2825050: Pack and unpack scripts switched to bash (Closed) Base URL: ssh://gitrw.chromium.org/crosutils.git
Patch Set: Created 10 years, 5 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 | « no previous file | 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"
(...skipping 10 matching lines...) Expand all
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 26 locate_gpt
27 27
28 TMP=$(mktemp) 28 TMP=$(mktemp)
29 $GPT show "$IMAGE" > $TMP 29 $GPT show "$IMAGE" > $TMP
30 30
31 HEADER='#!/bin/sh -eu 31 HEADER='#!/bin/bash -eu
32 # File generated by emit_gpt_scripts.sh. Do not edit. 32 # File generated by emit_gpt_scripts.sh. Do not edit.
33 TARGET=${1:-} 33 TARGET=${1:-}
34 if [[ -z "$TARGET" ]]; then 34 if [[ -z "$TARGET" ]]; then
35 echo "Usage: $0 DEVICE" 1>&2 35 echo "Usage: $0 DEVICE" 1>&2
36 exit 1 36 exit 1
37 fi 37 fi
38 set -x' 38 set -x'
39 39
40 echo "$HEADER" > "$PACK" 40 echo "$HEADER" > "$PACK"
41 echo "$HEADER" > "$UNPACK" 41 echo "$HEADER" > "$UNPACK"
42 cat $TMP | sed -e 's/^/# /' >> "$PACK" 42 cat $TMP | sed -e 's/^/# /' >> "$PACK"
43 cat $TMP | sed -e 's/^/# /' >> "$UNPACK" 43 cat $TMP | sed -e 's/^/# /' >> "$UNPACK"
44 44
45 $GPT show -q "$IMAGE" | \ 45 $GPT show -q "$IMAGE" | \
46 while read start size part x; do \ 46 while read start size part x; do \
47 file="part_$part" 47 file="part_$part"
48 loc="\"\$TARGET\"" 48 loc="\"\$TARGET\""
49 echo "dd if=$loc of=$file bs=512 skip=$start count=$size" \ 49 echo "dd if=$loc of=$file bs=512 skip=$start count=$size" \
50 >> "$UNPACK" 50 >> "$UNPACK"
51 echo \ 51 echo \
52 "dd if=$file of=$loc bs=512 seek=$start count=$size conv=notrunc" \ 52 "dd if=$file of=$loc bs=512 seek=$start count=$size conv=notrunc" \
53 >> "$PACK" 53 >> "$PACK"
54 done 54 done
55 55
56 chmod +x "$PACK" "$UNPACK" 56 chmod +x "$PACK" "$UNPACK"
57 57
58 rm $TMP 58 rm $TMP
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698