Skip to content

Commit

Permalink
feat(extracting): Switch from 7z (p7zip) to 7zz (7zip)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoninoScordino committed Sep 23, 2024
1 parent e8f1ae6 commit ae40cc8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions extract_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ else
echo "Trying to extract $p partition via fsck.erofs."
~/Firmware_extractor/tools/Linux/bin/fsck.erofs --extract="$p" "$p".img || {

# Uses '7z' if images could not be extracted via 'fsck.erofs'
echo "Extraction via fsck.erofs failed, extracting $p partition via 7z"
7z x "$p".img -y -o"$p"/ || {
# Uses '7zz' if images could not be extracted via 'fsck.erofs'
echo "Extraction via fsck.erofs failed, extracting $p partition via 7zz"
7zz x "$p".img -y -o"$p"/ || {

# Uses mount 'loop' if extraction via '7z' failed
# Uses mount 'loop' if extraction via '7zz' failed
rm -rf "${p}"/*
echo "Couldn't extract $p partition via 7z. Using mount loop"
echo "Couldn't extract $p partition via 7zz. Using mount loop"
mount -o loop -t auto "$p".img "$p"
mkdir "${p}_"
cp -rf "${p}/*" "${p}_"
Expand Down Expand Up @@ -289,7 +289,7 @@ if [[ -f "${PWD}/boot.img" ]]; then
## Run only if 'boot.img-ramdisk' is not empty
if [[ $(file boot.img-ramdisk | grep LZ4) || $(file boot.img-ramdisk | grep gzip) ]]; then
unlz4 "${OUTPUT}/boot.img-ramdisk" "${OUTPUT}/ramdisk.lz4"
7z x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"
7zz x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"

## Clean-up
rm -rf "${OUTPUT}/ramdisk.lz4"
Expand Down Expand Up @@ -332,7 +332,7 @@ if [[ -f "${PWD}/vendor_boot.img" ]]; then

# Decrompress 'vendor_boot.img-vendor_ramdisk'
unlz4 "${OUTPUT}/vendor_boot.img-vendor_ramdisk" "${OUTPUT}/ramdisk.lz4"
7z x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"
7zz x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"

## Clean-up
rm -rf "${OUTPUT}/ramdisk.lz4"
Expand Down Expand Up @@ -373,7 +373,7 @@ if [[ -f "${PWD}/vendor_kernel_boot.img" ]]; then

# Decrompress 'vendor_kernel_boot.img-vendor_ramdisk'
unlz4 "${OUTPUT}/vendor_kernel_boot.img-vendor_ramdisk" "${OUTPUT}/ramdisk.lz4"
7z x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"
7zz x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"

## Clean-up
rm -rf "${OUTPUT}/ramdisk.lz4"
Expand Down Expand Up @@ -402,7 +402,7 @@ if [[ -f "${PWD}/init_boot.img" ]]; then

# Decrompress 'init_boot.img-ramdisk'
unlz4 "${OUTPUT}/init_boot.img-ramdisk" "${OUTPUT}/ramdisk.lz4"
7z x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"
7zz x "${OUTPUT}/ramdisk.lz4" -o"${OUTPUT}/ramdisk"

## Clean-up
rm -rf "${OUTPUT}/ramdisk.lz4"
Expand Down Expand Up @@ -438,7 +438,7 @@ for dir in "vendor/euclid" "system/system/euclid" "reserve/reserve"; do
for f in *.img; do
[[ -f $f ]] || continue
sendTG_edit_wrapper temporary "${MESSAGE_ID}" "${MESSAGE}"$'\n'"<code>Partition Name: ${p}</code>" > /dev/null
7z x "$f" -o"${f/.img/}"
7zz x "$f" -o"${f/.img/}"
rm -fv "$f"
done
popd || terminate 1
Expand Down

0 comments on commit ae40cc8

Please sign in to comment.