From 0dcf3fe2a35c4f0478eaebd4ff753882a59c879c Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Tue, 21 Apr 2020 23:03:20 +0800 Subject: [PATCH] extract_utils: Support odm/product/vendor partition for zip extract Change-Id: Iec06835f1703e276f8882c5ee327ef241a2f8f23 --- build/tools/extract_utils.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh index 49c832e..cfbad5c 100755 --- a/build/tools/extract_utils.sh +++ b/build/tools/extract_utils.sh @@ -1473,18 +1473,23 @@ function extract() { if [ -a "$DUMPDIR"/payload.bin ]; then echo "A/B style OTA zip detected. This is not supported at this time. Stopping..." exit 1 - # If OTA is block based, extract it. - elif [ -a "$DUMPDIR"/system.new.dat ]; then - echo "Converting system.new.dat to system.img" - python "$DU_ROOT"/vendor/du/build/tools/sdat2img.py "$DUMPDIR"/system.transfer.list "$DUMPDIR"/system.new.dat "$DUMPDIR"/system.img 2>&1 - rm -rf "$DUMPDIR"/system.new.dat "$DUMPDIR"/system - mkdir "$DUMPDIR"/system "$DUMPDIR"/tmp - echo "Requesting sudo access to mount the system.img" - sudo mount -o loop "$DUMPDIR"/system.img "$DUMPDIR"/tmp - cp -r "$DUMPDIR"/tmp/* "$DUMPDIR"/system/ - sudo umount "$DUMPDIR"/tmp - rm -rf "$DUMPDIR"/tmp "$DUMPDIR"/system.img fi + + for PARTITION in "system" "odm" "product" "vendor" + do + # If OTA is block based, extract it. + if [ -a "$DUMPDIR"/"$PARTITION".new.dat ]; then + echo "Converting "$PARTITION".new.dat to "$PARTITION".img" + python "$DU_ROOT"/vendor/du/build/tools/sdat2img.py "$DUMPDIR"/"$PARTITION".transfer.list "$DUMPDIR"/"$PARTITION".new.dat "$DUMPDIR"/"$PARTITION".img 2>&1 + rm -rf "$DUMPDIR"/"$PARTITION".new.dat "$DUMPDIR"/"$PARTITION" + mkdir "$DUMPDIR"/"$PARTITION" "$DUMPDIR"/tmp + echo "Requesting sudo access to mount the "$PARTITION".img" + sudo mount -o loop "$DUMPDIR"/"$PARTITION".img "$DUMPDIR"/tmp + cp -r "$DUMPDIR"/tmp/* "$DUMPDIR"/"$PARTITION"/ + sudo umount "$DUMPDIR"/tmp + rm -rf "$DUMPDIR"/tmp "$DUMPDIR"/"$PARTITION".img + fi + done fi SRC="$DUMPDIR"