Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a636d2a authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

adb-remount-test: Discover fstab pathname more intelligently

Pick exactly one fstab file whose pathname suffix matches one of the
fstab suffix properties.
This helps on CF who ships redundant copies of fstab.

Bug: 243116800
Test: adb-remount-test
Change-Id: I4d38859014161e14dba1f7e19dbce44a2621d0f1
parent 32277d09
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -950,14 +950,23 @@ ACTIVE_SLOT=`get_active_slot`
  LOG INFO "active slot is ${ACTIVE_SLOT}"

# Acquire list of system partitions
FSTAB_SUFFIXES=(
  "$(get_property ro.boot.fstab_suffix)"
  "$(get_property ro.boot.hardware)"
  "$(get_property ro.boot.hardware.platform)"
)
FSTAB_PATTERN='\.('"$(join_with "|" "${FSTAB_SUFFIXES[@]}")"')$'
FSTAB_FILE=$(adb_su ls -1 '/vendor/etc/fstab*' </dev/null |
             grep -E "${FSTAB_PATTERN}" |
             head -1)

# KISS (assume system partition mount point is "/<partition name>")
PARTITIONS=`adb_su cat /vendor/etc/fstab* </dev/null |
              grep -v "^[#${SPACE}${TAB}]" |
[ -n "${FSTAB_FILE}" ] &&
  PARTITIONS=$(adb_su grep -v "^[#${SPACE}${TAB}]" "${FSTAB_FILE}" |
               skip_administrative_mounts |
               awk '$1 ~ /^[^\/]+$/ && "/"$1 == $2 && $4 ~ /(^|,)ro(,|$)/ { print $1 }' |
               sort -u |
              tr '\n' ' '`
               tr '\n' ' ')
PARTITIONS="${PARTITIONS:-system vendor}"
# KISS (we do not support sub-mounts for system partitions currently)
MOUNTS="`for i in ${PARTITIONS}; do