Backend: fixes for mounting system on Lineage Recovery

- Lineage has a mindboggling: /system_root as mountpoint in ramdisk, neither /system nor /system_root in fstab (it has / instead, which is useless), ANDROID_ROOT=/system, and a possible symlink from /system to /system_root/system
- this failure to have a sensible, working fstab triggers the fallback to mounting directly from /dev/block/bootdevice which should exist on all modern devices which would need this SAR fallback
- add basic slot support for the fallback mount, since Lineage Recovery also doesn't make symlinks to the active slot partitions
This commit is contained in:
osm0sis committed 2020-01-27 15:28:11 -04:00
1 parent b772cca3ac
commit 03af96a541
1 file changed
+6 -6
+6 -6
View File
@@ -97,11 +97,11 @@ mount_all() {
elif [ -f /system/system/build.prop ]; then
setup_mountpoint /system_root;
$BB mount --move /system /system_root;
if [ $? != 0 ]; then
$BB umount /system;
$BB umount -l /system 2>/dev/null;
$BB mount -o ro -t auto /dev/block/bootdevice/by-name/system /system_root;
fi;
fi;
if [ $? != 0 ]; then
$BB umount /system;
$BB umount -l /system 2>/dev/null;
$BB mount -o ro -t auto /dev/block/bootdevice/by-name/system$(getprop ro.boot.slot_suffix 2>/dev/null) /system_root;
fi;
;;
esac;
@@ -163,7 +163,7 @@ restore_env() {
test "$OLDLDPRE" && export LD_PRELOAD="$OLDLDPRE";
umount_all;
(for dir in /apex /system /system_root; do
if [ -e "${dir}_link" ]; then
if [ -L "${dir}_link" ]; then
rmdir $dir;
$BB mv -f ${dir}_link $dir;
fi;