diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 1b6f098..f9e47ab 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -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 @@ -333,6 +362,7 @@ if ! mount | grep /vendor >/dev/null; then exit 3 fi +vendor_free_size_check disable_fbe disable_recovery_restoration