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
diff --git a/addonsu/unmount-system.sh b/addonsu/unmount-system.sh
new file mode 100644
index 0000000..60c5e18
--- /dev/null
+++ b/addonsu/unmount-system.sh
@@ -0,0 +1,15 @@
+#!/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