platform_vendor_tequila/addonsu/unmount-system.sh
Christopher N. Hesse 1f94c931e0 addonsu: Fix package for modern devices
Recent devices (e.g. Pixel 2XL aka taimen) do not define any "system"
partition in their fstab, so a plain "mount /system" fails.

Furthermore, trying to get the entry from /etc/recovery.fstab also fails
because the partitions have slot suffixes (e.g. system_a).
So for these devices, we need to figure out the active slot, mount the
system partition (which really contains the whole root) and lastly mount
the actual system partition from the rootfs.

Change-Id: Ibb73a82896c1f6ce6af9c334b8d0908a183913b9
2018-06-22 16:34:05 +02:00

15 lines
263 B
Bash

#!/sbin/sh
# Modern devices use /system as root ("/")
system_as_root=`getprop ro.build.system_root_image`
if [ "$system_as_root" == "true" ]; then
if umount /system && umount /system_root; then
exit 0
fi
fi
if umount /system; then
exit 0
fi
exit 1