Merge "adb-remount-test: Refactor prologue & /sys/module/overlay mining"
This commit is contained in:
commit
2e0913ce6c
1 changed files with 35 additions and 39 deletions
|
|
@ -213,15 +213,6 @@ get_property() {
|
|||
adb_sh getprop ${1} </dev/null
|
||||
}
|
||||
|
||||
[ "USAGE: isDebuggable
|
||||
|
||||
Returns: true if device is (likely) a debug build" ]
|
||||
isDebuggable() {
|
||||
if inAdb && [ 1 != "`get_property ro.debuggable`" ]; then
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
[ "USAGE: adb_su <commands> </dev/stdin >/dev/stdout 2>/dev/stderr
|
||||
|
||||
Returns: true if the command running as root succeeded" ]
|
||||
|
|
@ -905,7 +896,13 @@ if ! inAdb; then
|
|||
adb_wait ${ADB_WAIT}
|
||||
fi
|
||||
inAdb || die "specified device not in adb mode"
|
||||
isDebuggable || die "device not a debug build"
|
||||
[ "1" = "$(get_property ro.debuggable)" ] || die "device not a debug build"
|
||||
[ "orange" = "$(get_property ro.boot.verifiedbootstate)" ] || die "device not bootloader unlocked"
|
||||
can_restore_verity=true
|
||||
if [ "2" != "$(get_property partition.system.verified)" ]; then
|
||||
LOG WARNING "device might not support verity"
|
||||
can_restore_verity=false
|
||||
fi
|
||||
enforcing=true
|
||||
if ! adb_su getenforce </dev/null | grep 'Enforcing' >/dev/null; then
|
||||
LOG WARNING "device does not have sepolicy in enforcing mode"
|
||||
|
|
@ -985,8 +982,33 @@ adb_sh ls -l /dev/block/by-name/ /dev/block/mapper/ </dev/null 2>/dev/null |
|
|||
LOG INFO "partition ${name} device ${device} size ${size}K"
|
||||
done
|
||||
|
||||
LOG RUN "Checking kernel support for overlayfs"
|
||||
|
||||
overlayfs_supported=true
|
||||
can_restore_verity=false
|
||||
adb_root || die "becoming root to mine kernel information"
|
||||
if ! adb_test -d /sys/module/overlay; then
|
||||
if adb_sh grep -q "nodev${TAB}overlay" /proc/filesystems; then
|
||||
LOG OK "overlay module present"
|
||||
else
|
||||
LOG WARNING "overlay module not present"
|
||||
overlayfs_supported=false
|
||||
fi
|
||||
fi >&2
|
||||
if ${overlayfs_supported}; then
|
||||
if adb_test -f /sys/module/overlay/parameters/override_creds; then
|
||||
LOG OK "overlay module supports override_creds"
|
||||
else
|
||||
case "$(adb_sh uname -r </dev/null)" in
|
||||
4.[456789].* | 4.[1-9][0-9]* | [56789].*)
|
||||
LOG WARNING "overlay module does not support override_creds"
|
||||
overlayfs_supported=false
|
||||
;;
|
||||
*)
|
||||
LOG OK "overlay module uses caller's creds"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
restore() {
|
||||
LOG INFO "restoring device"
|
||||
|
|
@ -1030,7 +1052,6 @@ fi
|
|||
# Can we test remount -R command?
|
||||
if [ "orange" = "$(get_property ro.boot.verifiedbootstate)" ] &&
|
||||
[ "2" = "$(get_property partition.system.verified)" ]; then
|
||||
can_restore_verity=true
|
||||
|
||||
LOG RUN "Testing adb shell su root remount -R command"
|
||||
|
||||
|
|
@ -1058,35 +1079,10 @@ ${INDENT}partition.system.verified=\"`get_property partition.system.verified`\""
|
|||
LOG OK "adb shell su root remount -R command"
|
||||
fi
|
||||
|
||||
LOG RUN "Testing kernel support for overlayfs"
|
||||
LOG RUN "Checking current overlayfs status"
|
||||
|
||||
adb_wait || die "wait for device failed"
|
||||
adb_root ||
|
||||
die "initial setup"
|
||||
|
||||
adb_test -d /sys/module/overlay ||
|
||||
adb_sh grep "nodev${TAB}overlay" /proc/filesystems </dev/null >/dev/null 2>/dev/null &&
|
||||
LOG OK "overlay module present" ||
|
||||
(
|
||||
LOG WARNING "overlay module not present" &&
|
||||
false
|
||||
) ||
|
||||
overlayfs_supported=false
|
||||
if ${overlayfs_supported}; then
|
||||
adb_test -f /sys/module/overlay/parameters/override_creds &&
|
||||
LOG OK "overlay module supports override_creds" ||
|
||||
case `adb_sh uname -r </dev/null` in
|
||||
4.[456789].* | 4.[1-9][0-9]* | [56789].*)
|
||||
LOG WARNING "overlay module does not support override_creds" &&
|
||||
overlayfs_supported=false
|
||||
;;
|
||||
*)
|
||||
LOG OK "overlay module uses caller's creds"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
LOG RUN "Checking current overlayfs status"
|
||||
adb_root || die "adb root failed"
|
||||
|
||||
# We can not universally use adb enable-verity to ensure device is
|
||||
# in a overlayfs disabled state since it can prevent reboot on
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue