blob: 5886f153defe2685e8311d8a195adf6fb9ed58c7 [file] [log] [blame]
Gabriele M5b33c6c2017-01-22 22:50:02 +01001#!/sbin/sh
2
3if mount /system; then
4 exit 0
5fi
6
7# Try to get the block from /etc/recovery.fstab
8block=`cat /etc/recovery.fstab | cut -d '#' -f 1 | grep /system | grep -o '/dev/[^ ]*' | head -1`
9if [ -n "$block" ] && mount $block /system; then
10 exit 0
11fi
12
Christopher N. Hesse1f94c932018-06-11 21:56:24 +020013# Modern devices use /system as root ("/")
14system_as_root=`getprop ro.build.system_root_image`
15if [ "$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
26fi
27
Gabriele M5b33c6c2017-01-22 22:50:02 +010028exit 1