Merge changes Ic2fd4056,I198fb9b7,I0d61ea11,I59d9b8f7
* changes: Retry the command for querying parent artifacts Revise comments for when -v, -m options are needed Check first if system_dir and device_dir exists Print error on missing device target_files archive
This commit is contained in:
@@ -7,11 +7,11 @@ usage () {
|
|||||||
echo
|
echo
|
||||||
echo "Options -v, -m, -p must precede positional arguments."
|
echo "Options -v, -m, -p must precede positional arguments."
|
||||||
echo
|
echo
|
||||||
echo "vendor_version is the version of the vendor image when the mixed"
|
echo "vendor_version is the version of the vendor image when Keymaster v3"
|
||||||
echo " build is inter branch. Optional."
|
echo " related modifications to the system image is necessary. Optional."
|
||||||
echo " eg. 8.1.0 for a mixed build of GSI and O-MR1 vendor image."
|
echo " eg. 8.1.0 for a mixed build of GSI and O-MR1 vendor image."
|
||||||
echo "modify_system_image_path is the path to the script that modifies the"
|
echo "modify_system_image_path is the path to the script that modifies the"
|
||||||
echo " system image for an inter branch build target. Optional."
|
echo " system image, needed for Keymaster v3. Optional."
|
||||||
echo "override_vbmeta_image_path is the path to a vbmeta.img to use"
|
echo "override_vbmeta_image_path is the path to a vbmeta.img to use"
|
||||||
echo " to override the existing vbmeta.img of device. Optional."
|
echo " to override the existing vbmeta.img of device. Optional."
|
||||||
echo "system_build_dir is the path to the system build"
|
echo "system_build_dir is the path to the system build"
|
||||||
@@ -67,14 +67,6 @@ fi
|
|||||||
|
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
if [[ ! -z "${MODIFY_SYSTEM_SCRIPT+x}" && ! -f "$MODIFY_SYSTEM_SCRIPT" ]]; then
|
|
||||||
exit_badparam "Script not found: "$MODIFY_SYSTEM_SCRIPT""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PATH" ]]; then
|
|
||||||
exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $# -lt 3 ]]; then
|
if [[ $# -lt 3 ]]; then
|
||||||
exit_badparam "Unexpected number of arguments"
|
exit_badparam "Unexpected number of arguments"
|
||||||
fi
|
fi
|
||||||
@@ -85,21 +77,44 @@ readonly DIST_DIR="$3"
|
|||||||
readonly CHECK_TOOL="$4"
|
readonly CHECK_TOOL="$4"
|
||||||
readonly TEMP_DIR="$(mktemp -d /tmp/"$(basename $0)"_XXXXXXXX)"
|
readonly TEMP_DIR="$(mktemp -d /tmp/"$(basename $0)"_XXXXXXXX)"
|
||||||
|
|
||||||
readonly SYSTEM_TARGET_FILES_ARCHIVE="$(find "$SYSTEM_DIR" -name "*-target_files-*.zip" -print)"
|
# Retry command until a certain limit.
|
||||||
|
# Usage: retry "command"
|
||||||
|
retry () {
|
||||||
|
NEXT_WAIT_TIME=0
|
||||||
|
until ($1 && [[ -n "$($1)" ]]) || [[ $NEXT_WAIT_TIME -eq 4 ]]; do
|
||||||
|
sleep $(( ++NEXT_WAIT_TIME ))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
command="find "$SYSTEM_DIR" -name "*-target_files-*.zip" -print"
|
||||||
|
retry "$command"
|
||||||
|
readonly SYSTEM_TARGET_FILES_ARCHIVE="$($command)"
|
||||||
if [[ ! -f "$SYSTEM_TARGET_FILES_ARCHIVE" ]]; then
|
if [[ ! -f "$SYSTEM_TARGET_FILES_ARCHIVE" ]]; then
|
||||||
exit_badparam "Could not find system target files archive in $SYSTEM_DIR."
|
exit_badparam "Could not find system target files archive in $SYSTEM_DIR."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly DEVICE_ARCHIVE="$(find "$DEVICE_DIR" -name "*-img-*.zip" -print)"
|
command="find "$DEVICE_DIR" -name "*-img-*.zip" -print"
|
||||||
|
retry "$command"
|
||||||
|
readonly DEVICE_ARCHIVE="$($command)"
|
||||||
if [[ ! -f "$DEVICE_ARCHIVE" ]]; then
|
if [[ ! -f "$DEVICE_ARCHIVE" ]]; then
|
||||||
exit_badparam "Could not find device img archive in $DEVICE_DIR."
|
exit_badparam "Could not find device img archive in $DEVICE_DIR."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly DEVICE_TARGET_FILES_ARCHIVE="$(find "$DEVICE_DIR" -name "*-target_files-*.zip" -print)"
|
command="find "$DEVICE_DIR" -name "*-target_files-*.zip" -print"
|
||||||
if [[ ! -f "$DEVICE_ARCHIVE" ]]; then
|
retry "$command"
|
||||||
|
readonly DEVICE_TARGET_FILES_ARCHIVE="$($command)"
|
||||||
|
if [[ ! -f "$DEVICE_TARGET_FILES_ARCHIVE" ]]; then
|
||||||
exit_badparam "Could not find device target_files archive in $DEVICE_DIR."
|
exit_badparam "Could not find device target_files archive in $DEVICE_DIR."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${MODIFY_SYSTEM_SCRIPT+x}" && ! -f "$MODIFY_SYSTEM_SCRIPT" ]]; then
|
||||||
|
exit_badparam "Script not found: "$MODIFY_SYSTEM_SCRIPT""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PATH" ]]; then
|
||||||
|
exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH""
|
||||||
|
fi
|
||||||
|
|
||||||
readonly DEVICE_ARTIFACTS_DIR="$TEMP_DIR"/device_archive_artifacts
|
readonly DEVICE_ARTIFACTS_DIR="$TEMP_DIR"/device_archive_artifacts
|
||||||
readonly DEVICE_IMAGES_DIR="$DEVICE_ARTIFACTS_DIR"/IMAGES
|
readonly DEVICE_IMAGES_DIR="$DEVICE_ARTIFACTS_DIR"/IMAGES
|
||||||
readonly SYSTEM_ARTIFACTS_DIR="$TEMP_DIR"/system_artifacts
|
readonly SYSTEM_ARTIFACTS_DIR="$TEMP_DIR"/system_artifacts
|
||||||
|
|||||||
Reference in New Issue
Block a user