Backend: fix loop mounts on newer Lineage-based recoveries
- loops would fail only in LOS Recovery from direct mount .img and losetup .img+loop mount with, e.g. "mount: mounting /dev/block/loop0 on /apex/com.android.adbd failed: Invalid argument" - this started ~LOS19, I believe, though I haven't tracked down the specific change yet - confusing to diagnose, since it always works in recovery adb shell, until I realized there was a context difference: "su" for adb shell and "recovery" for zip flashes - switch shell context temporarily to "su" to do apex mounts, then return to original context (currently only necessary for mounting loops)
This commit is contained in:
2 files changed
+5
-2
No files matched your search
@@ -54,9 +54,11 @@ setup_mountpoint() {
|
||||
is_mounted() { mount | grep -q " $1 "; }
|
||||
mount_apex() {
|
||||
[ -d /system_root/system/apex ] || return 1;
|
||||
local apex dest loop minorx num var;
|
||||
local apex dest loop minorx num shcon var;
|
||||
setup_mountpoint /apex;
|
||||
mount -t tmpfs tmpfs /apex -o mode=755 && touch /apex/apextmp;
|
||||
shcon=$(cat /proc/self/attr/current);
|
||||
echo "u:r:su:s0" > /proc/self/attr/current; # work around LOS Recovery not allowing loop mounts in recovery context
|
||||
minorx=1;
|
||||
[ -e /dev/block/loop1 ] && minorx=$(ls -l /dev/block/loop1 | awk '{ print $6 }');
|
||||
num=0;
|
||||
@@ -92,6 +94,7 @@ mount_apex() {
|
||||
*) mount -o bind $apex $dest && echo "$dest (bind)" >&2;;
|
||||
esac;
|
||||
done;
|
||||
echo "$shcon" > /proc/self/attr/current;
|
||||
for var in $(grep -o 'export .* /.*' /system_root/init.environ.rc | awk '{ print $2 }'); do
|
||||
eval OLD_${var}=\$$var;
|
||||
done;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
|
||||
#
|
||||
#
|
||||
# AK_BASE_VERSION=20230525
|
||||
# AK_BASE_VERSION=20230526
|
||||
Reference in new issue
Block a user