From adb99b5fde4152fe0dfe17ab8b1b18b053923371 Mon Sep 17 00:00:00 2001 From: FriendlyNeighborhoodShane Date: Sun, 14 Aug 2022 21:10:30 +0530 Subject: [PATCH] update-binary: use a list for cleanup unmounting --- src/META-INF/com/google/android/update-binary | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/META-INF/com/google/android/update-binary b/src/META-INF/com/google/android/update-binary index 2affe0b..51d0b4a 100644 --- a/src/META-INF/com/google/android/update-binary +++ b/src/META-INF/com/google/android/update-binary @@ -48,10 +48,13 @@ file_getprop() { grep "^$2" "$1" | head -n1 | select_word 1 | cut -d= -f2; } +umountparts=""; cleanup() { rm -rf "$filedir" "$bbdir"; $bootmode || { - if [ "$sysroot" ]; then umount "$sysroot"; else umount "/system"; fi; + for part in $umountparts; do + umount "$part"; + done; } sync; } @@ -79,10 +82,13 @@ log "Zip File is $zipfile"; log "Bootmode is $bootmode"; $bootmode || { - [ -e "/system" ] && mount -o ro /system; - [ -e "/system_root" ] && mount -o ro /system_root; - [ -e "/mnt/system" ] && mount -o ro /mnt/system; + for part in "/system" "/system_root" "/mnt/system"; do + [ -e "$part" ] || continue; + mount -o ro "$part"; + umountparts="$umountparts $part"; + done; mount /data; + umountparts="$umountparts /data"; } [ -e "/system/system/build.prop" ] && sysroot="system"; [ -e "/system_root/system/build.prop" ] && sysroot="system_root";