crosutils: add --hwid_updater in make_factory_package.sh

A new parameter --hwid_updater is added to support updating
HWID component list by mini-omaha server.

BUG=chrome-os-partner:4276
TEST=./make_factory_package --release RELEASE --factory FACTORY \
     --firmware FIRMWARE --hwid hwid_updater.sh # success

Change-Id: I5889bf63545f0ed118320b60963e22ebc00c76f7
Reviewed-on: http://gerrit.chromium.org/gerrit/1826
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
Hung-Te Lin 2011-05-31 18:09:10 +08:00
parent 981555b638
commit fbc89da362

View File

@ -50,6 +50,8 @@ DEFINE_string factory "" \
"Directory and file containing factory image: /path/chromiumos_test_image.bin" "Directory and file containing factory image: /path/chromiumos_test_image.bin"
DEFINE_string firmware_updater "" \ DEFINE_string firmware_updater "" \
"If set, include the firmware shellball into the server configuration" "If set, include the firmware shellball into the server configuration"
DEFINE_string hwid_updater "" \
"If set, include the component list updater for HWID validation"
DEFINE_string release "" \ DEFINE_string release "" \
"Directory and file containing release image: /path/chromiumos_image.bin" "Directory and file containing release image: /path/chromiumos_image.bin"
DEFINE_string subfolder "" \ DEFINE_string subfolder "" \
@ -80,6 +82,12 @@ if [ -n "${FLAGS_firmware_updater}" ] &&
exit 1 exit 1
fi fi
if [ -n "${FLAGS_hwid_updater}" ] &&
[ ! -f "${FLAGS_hwid_updater}" ]; then
echo "Cannot find HWID component list updater ${FLAGS_hwid_updater}"
exit 1
fi
# Convert args to paths. Need eval to un-quote the string so that shell # Convert args to paths. Need eval to un-quote the string so that shell
# chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work.
OMAHA_DIR="${SRC_ROOT}/platform/dev" OMAHA_DIR="${SRC_ROOT}/platform/dev"
@ -340,17 +348,18 @@ generate_omaha() {
popd >/dev/null popd >/dev/null
if [ -n "${FLAGS_firmware_updater}" ]; then if [ -n "${FLAGS_firmware_updater}" ]; then
SHELLBALL="${FLAGS_firmware_updater}" firmware_hash="$(compress_and_hash_file "${FLAGS_firmware_updater}" \
if [ ! -f "$SHELLBALL" ]; then "firmware.gz")"
echo "Failed to find firmware updater: $SHELLBALL."
exit 1
fi
firmware_hash="$(compress_and_hash_file "$SHELLBALL" "firmware.gz")"
mv firmware.gz "${OMAHA_DATA_DIR}" mv firmware.gz "${OMAHA_DATA_DIR}"
echo "firmware: ${firmware_hash}" echo "firmware: ${firmware_hash}"
fi fi
if [ -n "${FLAGS_hwid_updater}" ]; then
hwid_hash="$(compress_and_hash_file "${FLAGS_hwid_updater}" "hwid.gz")"
mv hwid.gz "${OMAHA_DATA_DIR}"
echo "hwid: ${hwid_hash}"
fi
# If the file does exist and we are using the subfolder flag we are going to # If the file does exist and we are using the subfolder flag we are going to
# append another config. # append another config.
if [ -n "${FLAGS_subfolder}" ] && if [ -n "${FLAGS_subfolder}" ] &&
@ -404,6 +413,12 @@ generate_omaha() {
'firmware_checksum': '${firmware_hash}'," >>"${OMAHA_CONF}" 'firmware_checksum': '${firmware_hash}'," >>"${OMAHA_CONF}"
fi fi
if [ -n "${FLAGS_hwid_updater}" ] ; then
echo -n "
'hwid_image': '${subfolder}hwid.gz',
'hwid_checksum': '${hwid_hash}'," >>"${OMAHA_CONF}"
fi
echo -n " echo -n "
}, },
] ]