Gabriele M | 5b33c6c | 2017-01-22 22:50:02 +0100 | [diff] [blame] | 1 | #!/sbin/sh |
| 2 | |
| 3 | if mount /system; then |
| 4 | exit 0 |
| 5 | fi |
| 6 | |
| 7 | # Try to get the block from /etc/recovery.fstab |
| 8 | block=`cat /etc/recovery.fstab | cut -d '#' -f 1 | grep /system | grep -o '/dev/[^ ]*' | head -1` |
| 9 | if [ -n "$block" ] && mount $block /system; then |
| 10 | exit 0 |
| 11 | fi |
| 12 | |
Christopher N. Hesse | 1f94c93 | 2018-06-11 21:56:24 +0200 | [diff] [blame] | 13 | # Modern devices use /system as root ("/") |
| 14 | system_as_root=`getprop ro.build.system_root_image` |
| 15 | if [ "$system_as_root" == "true" ]; then |
| 16 | active_slot=`getprop ro.boot.slot_suffix` |
| 17 | if [ ! -z "$active_slot" ]; then |
| 18 | block=/dev/block/bootdevice/by-name/system$active_slot |
| 19 | else |
| 20 | block=/dev/block/bootdevice/by-name/system |
| 21 | fi |
| 22 | mkdir -p /system_root |
| 23 | if mount -o rw $block /system_root && mount /system_root/system /system; then |
| 24 | exit 0 |
| 25 | fi |
| 26 | fi |
| 27 | |
Gabriele M | 5b33c6c | 2017-01-22 22:50:02 +0100 | [diff] [blame] | 28 | exit 1 |