Merge "build_mixed: removed product.img if system_dir does not have one."

am: f6bdd28a3f

Change-Id: I4d0bfc85d9c42b9d6efdf2f5c2b4a874fbd7ba18
This commit is contained in:
Justin Yun
2019-01-04 00:52:27 -08:00
committed by android-build-merger

View File

@@ -19,6 +19,8 @@ usage () {
echo " to override the existing vbmeta.img of device. Optional."
echo "-s is used to fetch and flash both product.img and system.img from"
echo " the system_build_dir for devices with a product partition."
echo " product.img will be removed if system_build_dir does not have"
echo " product.img when -s option is declared."
echo " By default, only system.img is flashed to the target device for"
echo " independent system update. No parameter required. Optional"
echo "system_build_dir is the path to the system build"
@@ -134,6 +136,7 @@ EXTRACT_FILE_LIST=(
)
if [[ "$INCLUDE_PRODUCT" == true ]]; then
unzip -l "$SYSTEM_TARGET_FILES_ARCHIVE" | grep -q IMAGES/product.img &&
EXTRACT_FILE_LIST+=(IMAGES/product.img)
fi
@@ -200,7 +203,13 @@ fi
# Overwrite artifacts in the device archive to create the Mixed Build artifacts.
cp "$SYSTEM_IMAGES_DIR"/system.img "$DEVICE_IMAGES_DIR"/
if [[ "$INCLUDE_PRODUCT" == true ]]; then
cp "$SYSTEM_IMAGES_DIR"/product.img "$DEVICE_IMAGES_DIR"/
if [[ -f "$SYSTEM_IMAGES_DIR"/product.img ]]; then
cp "$SYSTEM_IMAGES_DIR"/product.img "$DEVICE_IMAGES_DIR"/
else
rm -f "$DEVICE_IMAGES_DIR"/product.img
# Removed product partition from required partition list
sed -i "/partition-exists=product$/d" "$DEVICE_IMAGES_DIR"/android-info.txt
fi
fi
# Only override vbmeta if it is already present since fastboot update will try