Backend: update apex support

- support unmounting TWRP's mounted apex files to avoid conflicts
- hide less apex u/mount stderr to aid future debugging
This commit is contained in:
osm0sis committed 2021-10-16 14:54:06 -03:00
1 parent 74be8b014f
commit 049180b3cd
2 files changed
+7 -10

No files matched your search

+6 -9
View File
@@ -69,8 +69,8 @@ mount_apex() {
if [ $? != 0 ]; then
while [ $num -lt 64 ]; do
loop=/dev/block/loop$num;
($BB mknod $loop b 7 $((num * minorx));
$BB losetup $loop $dest.img) 2>/dev/null;
[ -e $loop ] || $BB mknod $loop b 7 $((num * minorx));
$BB losetup $loop $dest.img 2>/dev/null;
num=$((num + 1));
$BB losetup $loop | $BB grep -q $dest.img && break;
done;
@@ -89,9 +89,8 @@ mount_apex() {
$($BB grep -o 'export .* /.*' /system_root/init.environ.rc | $BB sed 's; /;=/;'); unset export;
}
umount_apex() {
[ -d /apex/com.android.runtime ] || return 1;
local dest loop var;
for var in $($BB grep -o 'export .* /.*' /system_root/init.environ.rc | $BB awk '{ print $2 }'); do
for var in $($BB grep -o 'export .* /.*' /system_root/init.environ.rc 2>/dev/null | $BB awk '{ print $2 }'); do
if [ "$(eval echo \$OLD_$var)" ]; then
eval $var=\$OLD_${var};
else
@@ -100,11 +99,9 @@ umount_apex() {
unset OLD_${var};
done;
for dest in $($BB find /apex -type d -mindepth 1 -maxdepth 1); do
if [ -f $dest.img ]; then
loop=$($BB mount | $BB grep $dest | $BB cut -d\ -f1);
fi;
($BB umount -l $dest;
$BB losetup -d $loop) 2>/dev/null;
loop=$($BB mount | $BB grep $dest | $BB grep loop | $BB cut -d\ -f1);
$BB umount -l $dest;
[ "$loop" ] && $BB losetup -d $loop;
done;
$BB rm -rf /apex 2>/dev/null;
}
+1 -1
View File
@@ -3,4 +3,4 @@
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
#
#
# AK_BASE_VERSION=20211004
# AK_BASE_VERSION=20211016