From cfc4720c28a17a04ea833809178bda540d44dfa4 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Sat, 17 Sep 2011 15:42:40 +0800 Subject: [PATCH] crosutils: refine make_factory_package Change non-posix pushd and popd into posix sub commands. Added a check of --board to be non-zero for omaha setup. BUG=chrome-os-partner:5979 TEST=./make_factory_package.sh --config bundle/mp_factory.conf Change-Id: I1aa847ae2df28460319ca0b574ca4921993e41e1 Reviewed-on: http://gerrit.chromium.org/gerrit/7904 Tested-by: Hung-Te Lin Reviewed-by: Nick Sanders --- make_factory_package.sh | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/make_factory_package.sh b/make_factory_package.sh index b412a5df30..20a034e5f9 100755 --- a/make_factory_package.sh +++ b/make_factory_package.sh @@ -481,6 +481,7 @@ generate_img() { generate_omaha() { local kernel rootfs + [ -n "$FLAGS_board" ] || die "Need --board parameter for mini-omaha server." # Clean up stale config and data files. prepare_dir "${OMAHA_DATA_DIR}" @@ -490,41 +491,40 @@ generate_omaha() { echo "Output omaha config to ${OMAHA_CONF}" # Get the release image. - # TODO(hungte) deprecate pushd and use temporary folders - pushd "${RELEASE_DIR}" >/dev/null - prepare_dir "." + ( set -e + cd "${RELEASE_DIR}" + prepare_dir "." - kernel="${RELEASE_KERNEL:-${RELEASE_IMAGE}:2}" - rootfs="${RELEASE_IMAGE}:3" - release_hash="$(compress_and_hash_memento_image "$kernel" "$rootfs")" - mv ./update.gz "${OMAHA_DATA_DIR}/rootfs-release.gz" - echo "release: ${release_hash}" + kernel="${RELEASE_KERNEL:-${RELEASE_IMAGE}:2}" + rootfs="${RELEASE_IMAGE}:3" + release_hash="$(compress_and_hash_memento_image "$kernel" "$rootfs")" + mv ./update.gz "${OMAHA_DATA_DIR}/rootfs-release.gz" + echo "release: ${release_hash}" - oem_hash="$(compress_and_hash_partition "${RELEASE_IMAGE}" 8 "oem.gz")" - mv oem.gz "${OMAHA_DATA_DIR}" - echo "oem: ${oem_hash}" - - popd >/dev/null + oem_hash="$(compress_and_hash_partition "${RELEASE_IMAGE}" 8 "oem.gz")" + mv oem.gz "${OMAHA_DATA_DIR}" + echo "oem: ${oem_hash}" + ) # Go to retrieve the factory test image. - pushd "${FACTORY_DIR}" >/dev/null - prepare_dir "." + ( set -e + cd "${FACTORY_DIR}" + prepare_dir "." - kernel="${FACTORY_IMAGE}:2" - rootfs="${FACTORY_IMAGE}:3" - test_hash="$(compress_and_hash_memento_image "$kernel" "$rootfs")" - mv ./update.gz "${OMAHA_DATA_DIR}/rootfs-test.gz" - echo "test: ${test_hash}" + kernel="${FACTORY_IMAGE}:2" + rootfs="${FACTORY_IMAGE}:3" + test_hash="$(compress_and_hash_memento_image "$kernel" "$rootfs")" + mv ./update.gz "${OMAHA_DATA_DIR}/rootfs-test.gz" + echo "test: ${test_hash}" - state_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 1 "state.gz")" - mv state.gz "${OMAHA_DATA_DIR}" - echo "state: ${state_hash}" + state_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 1 "state.gz")" + mv state.gz "${OMAHA_DATA_DIR}" + echo "state: ${state_hash}" - efi_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 12 "efi.gz")" - mv efi.gz "${OMAHA_DATA_DIR}" - echo "efi: ${efi_hash}" - - popd >/dev/null + efi_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 12 "efi.gz")" + mv efi.gz "${OMAHA_DATA_DIR}" + echo "efi: ${efi_hash}" + ) if [ -n "${FLAGS_firmware_updater}" ]; then firmware_hash="$(compress_and_hash_file "${FLAGS_firmware_updater}" \