Skip to content

Commit 6c70a8e

Browse files
committed
revert(7704410): roll back to old 'superimage' implementation
1 parent cc7aaa1 commit 6c70a8e

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

extractor.sh

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,23 @@
2626

2727
shopt -s extglob
2828

29-
# superimage: Extract images from 'super.img.raw'
3029
superimage() {
31-
# Create a RAW image from a sparsed one
3230
if [ -f super.img ]; then
33-
echo "[INFO] Creating 'super.img.raw'..."
34-
"${simg2img}" "${PWD}/super.img" "${PWD}/super.img.raw" 2>/dev/null
31+
echo "Creating super.img.raw ..."
32+
$simg2img super.img super.img.raw 2>/dev/null
3533
fi
36-
37-
# Image is probably already a RAW
3834
if [[ ! -s super.img.raw ]] && [ -f super.img ]; then
39-
mv "${PWD}/super.img" "${PWD}/super.img.raw"
35+
mv super.img super.img.raw
4036
fi
41-
42-
for p in ${PARTITIONS}; do
43-
# Extract partitions from 'super.img.raw'
44-
"${lpunpack}" --partition="${p}"_a "${PWD}/super.img.raw" 2>/dev/null || \
45-
"${lpunpack}" --partition="${p}" "${PWD}/super.img.raw" 2>/dev/null && echo "[INFO] Extracted '${p}_a.img'"
46-
47-
if [ -f "${p}"_a.img ]; then
48-
# Remove partition slot suffix
49-
mv "${p}"_a.img "${p}".img
50-
elif [ -f "${romzip}" ]; then
51-
FOUND_PARTITIONS=$(7z l -ba "${romzip}" | rev | gawk '{ print $1 }' | rev | grep "${p}".img)
52-
7z e -y "${romzip}" "${FOUND_PARTITIONS}" 2>/dev/null >> "$tmpdir"/zip.log
37+
for partition in $PARTITIONS; do
38+
($lpunpack --partition="$partition"_a super.img.raw || $lpunpack --partition="$partition" super.img.raw) 2>/dev/null
39+
if [ -f "$partition"_a.img ]; then
40+
mv "$partition"_a.img "$partition".img
41+
elif [ -f "$romzip" ]; then
42+
foundpartitions=$(7z l -ba "${romzip}" | rev | gawk '{ print $1 }' | rev | grep "$partition".img)
43+
7z e -y "${romzip}" "$foundpartitions" dummypartition 2>/dev/null >> "$tmpdir"/zip.log
5344
fi
5445
done
55-
56-
# Clean-up
5746
rm -rf super.img*
5847
}
5948

0 commit comments

Comments
 (0)