Skip to content

Commit

Permalink
installer/addon: Check A/B partitioning with ro.build.ab_update instead
Browse files Browse the repository at this point in the history
* As osm0sis suggested (#879 (comment))
  some weird A only devices, seem to report slot as _a.

* So check with ro.build.ab_update instead (as its defined for every A/B device)

* $system_as_root in the installer.sh is unused elsewhere, so drop that too.

Reference:
 - https://source.android.com/devices/tech/ota/ab/ab_implement#build-variables
 - https://android.googlesource.com/platform/build/+/532fdf4479acb50cdb480e6fdfe24f0698fcd67b%5E%21/
 - https://android.googlesource.com/platform/build/+/refs/tags/android-7.1.0_r1/tools/buildinfo.sh#26
 - https://android.googlesource.com/platform/build/+/refs/tags/android-10.0.0_r41/tools/buildinfo.sh#28
  • Loading branch information
merothh authored and mfonville committed Sep 22, 2020
1 parent 000222c commit ebd7a64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions scripts/bkup_tail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ EOF
}

mount_generic() {
local active_slot=$(getprop ro.boot.slot_suffix)
local device_abpartition=$(getprop ro.build.ab_update)
local partitions="$*"
if [ -z "$active_slot" ]; then
if [ -z "$device_abpartition" ]; then
# We're on an A only device
local partition
for partition in $partitions; do
Expand Down
11 changes: 2 additions & 9 deletions scripts/templates/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1063,15 +1063,8 @@ ui_print " "

# _____________________________________________________________________________________________________________________
# Detect A/B partition layout https://source.android.com/devices/tech/ota/ab_updates
# and system-as-root https://source.android.com/devices/bootloader/system-as-root
device_abpartition=false
system_as_root=`getprop ro.build.system_root_image`
if [ "$system_as_root" = "true" ]; then
active_slot=`getprop ro.boot.slot_suffix`
if [ ! -z "$active_slot" ]; then
device_abpartition=true
fi
fi
device_abpartition=$(getprop ro.build.ab_update)
[ -n "$device_abpartition" ] || device_abpartition=false

# _____________________________________________________________________________________________________________________
# Declare Variables
Expand Down

0 comments on commit ebd7a64

Please sign in to comment.