Skip to content

Commit

Permalink
multidisabler: add vendor free size check
Browse files Browse the repository at this point in the history
  • Loading branch information
afaneh92 authored and corsicanu committed May 20, 2022
1 parent 0ea4dee commit 6e64e19
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,35 @@ rm_from_manifest() {
done
}

resize_vendor() {
local dm_block=$(df -k | cat | grep "/vendor" | cut -d' ' -f1)

ui_print " - Unmounting /vendor..."
umount /vendor
ui_print " - Checking vendor block partition before resizing..."
e2fsck -f $dm_block
ui_print " - Resizing the filesystem on $dm_block..."
resize2fs $dm_block
ui_print " - Make the partition R/W by unsharing its blocks..."
e2fsck -E unshare_blocks $dm_block
ui_print " - Remounting /vendor..."
mount /vendor
mount -o remount,rw /vendor
}

vendor_free_size_check() {
ui_print " - Checking vendor free size..."
if dd if=/dev/zero of=/vendor/test bs=1 count=1 2>/dev/null; then
ui_print " - ...succeeded."
rm -f /vendor/test
else
ui_print " - ...No free space left on vendor, attempting to resize vendor..."
ui_print " "
rm -f /vendor/test
resize_vendor
fi
}

disable_fbe() {
local md5
local i
Expand Down Expand Up @@ -333,6 +362,7 @@ if ! mount | grep /vendor >/dev/null; then
exit 3
fi

vendor_free_size_check
disable_fbe
disable_recovery_restoration

Expand Down

0 comments on commit 6e64e19

Please sign in to comment.