From 20044c2536833f3b59de03689bd75740bad6543f Mon Sep 17 00:00:00 2001 From: zainarbani Date: Tue, 11 Jul 2023 21:21:12 +0700 Subject: [PATCH 1/2] extractor.sh: Guard image zip firmware detection Some custom fw usually ship with addons (e.g., Magisk installer) Dont break loops if non fw archive detected. --- extractor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extractor.sh b/extractor.sh index ae0ec09..e92bdc0 100755 --- a/extractor.sh +++ b/extractor.sh @@ -430,7 +430,7 @@ elif [[ $(7z l -ba "$romzip" | grep payload.bin) ]]; then [[ -f "payload.bin" ]] && rm payload.bin rm -rf "$tmpdir" exit -elif [[ $(7z l -ba "$romzip" | grep ".*.rar\|.*.zip") ]]; then +elif [[ $(7z l -ba "$romzip" | grep ".*.rar\|.*.zip" | tr -s ' ' | cut -d' ' -f4 | awk '$0>300M') ]]; then echo "Image zip firmware detected" mkdir -p $tmpdir/zipfiles 7z e -y "$romzip" -o$tmpdir/zipfiles 2>/dev/null >> $tmpdir/zip.log From ea77c9775b33b8b61c6068596cf97f0999290ae2 Mon Sep 17 00:00:00 2001 From: Zain Arbani Date: Wed, 12 Jul 2023 23:35:58 +0700 Subject: [PATCH 2/2] extractor.sh: Handle symlink image files Found on Oppo Find X6 Pro factory fw (QFIL). --- extractor.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extractor.sh b/extractor.sh index e92bdc0..a4c2a55 100755 --- a/extractor.sh +++ b/extractor.sh @@ -235,6 +235,10 @@ elif [[ $(7z l -ba "$romzip" | grep rawprogram) ]]; then partitionsonzip=$(7z l -ba $romzip | gawk '{ print $NF }' | grep $partition) if [[ ! $partitionsonzip == "" ]]; then 7z e -y $romzip $partitionsonzip 2>/dev/null >> $tmpdir/zip.log + if [[ -L "$partition.img" ]]; then + partitionlink=$(7z l -ba $romzip | gawk '{ print $NF }' | grep `readlink "$partition.img"`) + 7z e -y $romzip $partitionlink -so > "$partition.img" + fi if [[ ! -f "$partition.img" ]]; then if [[ -f "$partition.raw.img" ]]; then mv "$partition.raw.img" "$partition.img"