summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric M. Blake <eblake@chromium.org>2011-09-15 11:39:35 -0700
committerEric Blake <eblake@chromium.org>2011-09-19 13:54:27 -0700
commit575746ee246b5e9b480a7dd2ea2f7112aa0d92bf (patch)
tree11889c2ceaac77bbe1190ad8eea53a47763b1d16
parent57e91f713f7e647e79ecdf7a6de878f638661e05 (diff)
downloadvboot-0.14.811.B.tar.gz
Allow path to the cgpt binary to be set on the command line0.14.811.B
BUG=chromium-os:17138 TEST=tested changes on vm8-m2, was able to successfully run au-generate.py and it used the cgpt binary from au-generate.zip Change-Id: Ia57f1be4b0d669cad430e51977cce6e26d704320 Reviewed-on: http://gerrit.chromium.org/gerrit/7796 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Reviewed-by: Eric Blake <eblake@chromium.org> Tested-by: Eric Blake <eblake@chromium.org> (cherry picked from commit 236faae91a224b36fb48ec407535a426f1f67877) Reviewed-on: http://gerrit.chromium.org/gerrit/7944 Reviewed-by: David McMahon <djmm@chromium.org> Tested-by: David McMahon <djmm@chromium.org>
-rwxr-xr-xscripts/image_signing/common_minimal.sh2
-rwxr-xr-xscripts/image_signing/convert_recovery_to_ssd.sh40
2 files changed, 28 insertions, 14 deletions
diff --git a/scripts/image_signing/common_minimal.sh b/scripts/image_signing/common_minimal.sh
index a68502e7..8db19449 100755
--- a/scripts/image_signing/common_minimal.sh
+++ b/scripts/image_signing/common_minimal.sh
@@ -10,7 +10,7 @@
# Determine script directory
SCRIPT_DIR=$(dirname $0)
PROG=$(basename $0)
-GPT=cgpt
+GPT=${GPT:-"cgpt"}
# The tag when the rootfs is changed.
TAG_NEEDS_TO_BE_SIGNED="/root/.need_to_be_signed"
diff --git a/scripts/image_signing/convert_recovery_to_ssd.sh b/scripts/image_signing/convert_recovery_to_ssd.sh
index 9b078afe..748522c8 100755
--- a/scripts/image_signing/convert_recovery_to_ssd.sh
+++ b/scripts/image_signing/convert_recovery_to_ssd.sh
@@ -7,33 +7,47 @@
# Script to convert a recovery image into an SSD image. Changes are made in-
# place.
-# Load common constants and variables.
-. "$(dirname "$0")/common_minimal.sh"
-
usage() {
cat <<EOF
-Usage: $PROG <image> [--force]
+Usage: $PROG <image> [--force] [--cgpt=/path/to/cgpt]
-In-place converts recovery <image> into an SSD image. With --force, does not ask for
-confirmation from the user.
+In-place converts recovery <image> into an SSD image. With --force, does not
+ask for confirmation from the user. Use --cgpt= to specify cgpt binary location.
EOF
+ exit 1
}
-if [ $# -gt 2 ]; then
+if [ $# -lt 1 ] || [ $# -gt 3 ]; then
usage
- exit 1
+else
+ IMAGE=$1
+ shift
fi
-type -P cgpt &>/dev/null ||
- { echo "cgpt tool must be in the path"; exit 1; }
+for arg in $*; do
+ case "$arg" in
+ --force)
+ IS_FORCE=$arg
+ ;;
+ --cgpt=*)
+ GPT=${arg#--cgpt=}
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
+# Load common constants (and use GPT if set above) and variables.
+. "$(dirname "$0")/common_minimal.sh"
+
+type -P $GPT &>/dev/null ||
+ { echo "cgpt tool must be in the path or specified via --cgpt"; exit 1; }
# Abort on errors.
set -e
-IMAGE=$1
-IS_FORCE=$2
-
if [ "${IS_FORCE}" != "--force" ]; then
echo "This will modify ${IMAGE} in-place and convert it into an SSD image."
read -p "Are you sure you want to continue (y/N)?" SURE