From b5816f7a8d3f69cb8d769a7d6e784c23bbe9796c Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 6 Nov 2013 15:44:12 -0800 Subject: [PATCH] fix(disk_layout_util.sh): Fix changing build_image's disk layout. Previously the code in base_image_util.sh properly handled the disk layout command line flag but the spaghetti code later on calls a function from disk_layout_util.sh which only returned 'base' resulting in a bit of a mess if something other than 'base' is used. Sync up the two code paths to avoid that... --- build_library/base_image_util.sh | 6 ++---- build_library/disk_layout_util.sh | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh index 56ff4eef61..9006021be6 100755 --- a/build_library/base_image_util.sh +++ b/build_library/base_image_util.sh @@ -39,11 +39,9 @@ cleanup_mounts() { create_base_image() { local image_name=$1 local rootfs_verification_enabled=$2 - local image_type="base" - if [[ "${FLAGS_disk_layout}" != "default" ]]; then - image_type="${FLAGS_disk_layout}" - fi + get_disk_layout_type + local image_type="${DISK_LAYOUT_TYPE}" check_valid_layout "base" check_valid_layout ${image_type} diff --git a/build_library/disk_layout_util.sh b/build_library/disk_layout_util.sh index 56d8cb2a4c..e337111e70 100644 --- a/build_library/disk_layout_util.sh +++ b/build_library/disk_layout_util.sh @@ -112,6 +112,10 @@ check_valid_layout() { get_disk_layout_type() { DISK_LAYOUT_TYPE="base" + if [[ -n "${FLAGS_disk_layout}" && \ + "${FLAGS_disk_layout}" != "default" ]]; then + DISK_LAYOUT_TYPE="${FLAGS_disk_layout}" + fi } emit_gpt_scripts() {