update-binary: use a list for cleanup unmounting

This commit is contained in:
FriendlyNeighborhoodShane 2022-08-14 21:10:30 +05:30
parent 7c40dd091c
commit adb99b5fde

View File

@ -48,10 +48,13 @@ file_getprop() {
grep "^$2" "$1" | head -n1 | select_word 1 | cut -d= -f2; grep "^$2" "$1" | head -n1 | select_word 1 | cut -d= -f2;
} }
umountparts="";
cleanup() { cleanup() {
rm -rf "$filedir" "$bbdir"; rm -rf "$filedir" "$bbdir";
$bootmode || { $bootmode || {
if [ "$sysroot" ]; then umount "$sysroot"; else umount "/system"; fi; for part in $umountparts; do
umount "$part";
done;
} }
sync; sync;
} }
@ -79,10 +82,13 @@ log "Zip File is $zipfile";
log "Bootmode is $bootmode"; log "Bootmode is $bootmode";
$bootmode || { $bootmode || {
[ -e "/system" ] && mount -o ro /system; for part in "/system" "/system_root" "/mnt/system"; do
[ -e "/system_root" ] && mount -o ro /system_root; [ -e "$part" ] || continue;
[ -e "/mnt/system" ] && mount -o ro /mnt/system; mount -o ro "$part";
umountparts="$umountparts $part";
done;
mount /data; mount /data;
umountparts="$umountparts /data";
} }
[ -e "/system/system/build.prop" ] && sysroot="system"; [ -e "/system/system/build.prop" ] && sysroot="system";
[ -e "/system_root/system/build.prop" ] && sysroot="system_root"; [ -e "/system_root/system/build.prop" ] && sysroot="system_root";