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 <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
This commit is contained in:
Hung-Te Lin 2011-09-17 15:42:40 +08:00 committed by chrome-bot
parent 1aa6124f1d
commit cfc4720c28

View File

@ -481,6 +481,7 @@ generate_img() {
generate_omaha() { generate_omaha() {
local kernel rootfs local kernel rootfs
[ -n "$FLAGS_board" ] || die "Need --board parameter for mini-omaha server."
# Clean up stale config and data files. # Clean up stale config and data files.
prepare_dir "${OMAHA_DATA_DIR}" prepare_dir "${OMAHA_DATA_DIR}"
@ -490,8 +491,8 @@ generate_omaha() {
echo "Output omaha config to ${OMAHA_CONF}" echo "Output omaha config to ${OMAHA_CONF}"
# Get the release image. # Get the release image.
# TODO(hungte) deprecate pushd and use temporary folders ( set -e
pushd "${RELEASE_DIR}" >/dev/null cd "${RELEASE_DIR}"
prepare_dir "." prepare_dir "."
kernel="${RELEASE_KERNEL:-${RELEASE_IMAGE}:2}" kernel="${RELEASE_KERNEL:-${RELEASE_IMAGE}:2}"
@ -503,11 +504,11 @@ generate_omaha() {
oem_hash="$(compress_and_hash_partition "${RELEASE_IMAGE}" 8 "oem.gz")" oem_hash="$(compress_and_hash_partition "${RELEASE_IMAGE}" 8 "oem.gz")"
mv oem.gz "${OMAHA_DATA_DIR}" mv oem.gz "${OMAHA_DATA_DIR}"
echo "oem: ${oem_hash}" echo "oem: ${oem_hash}"
)
popd >/dev/null
# Go to retrieve the factory test image. # Go to retrieve the factory test image.
pushd "${FACTORY_DIR}" >/dev/null ( set -e
cd "${FACTORY_DIR}"
prepare_dir "." prepare_dir "."
kernel="${FACTORY_IMAGE}:2" kernel="${FACTORY_IMAGE}:2"
@ -523,8 +524,7 @@ generate_omaha() {
efi_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 12 "efi.gz")" efi_hash="$(compress_and_hash_partition "${FACTORY_IMAGE}" 12 "efi.gz")"
mv efi.gz "${OMAHA_DATA_DIR}" mv efi.gz "${OMAHA_DATA_DIR}"
echo "efi: ${efi_hash}" echo "efi: ${efi_hash}"
)
popd >/dev/null
if [ -n "${FLAGS_firmware_updater}" ]; then if [ -n "${FLAGS_firmware_updater}" ]; then
firmware_hash="$(compress_and_hash_file "${FLAGS_firmware_updater}" \ firmware_hash="$(compress_and_hash_file "${FLAGS_firmware_updater}" \