1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-13 20:54:12 +01:00

Fallback to getprop when reading system props

Close #4153
This commit is contained in:
topjohnwu 2021-04-06 03:56:39 -07:00
parent 3da318b48e
commit 9c0e18975c

View File

@ -33,6 +33,16 @@ grep_prop() {
cat $FILES 2>/dev/null | dos2unix | sed -n "$REGEX" | head -n 1
}
grep_get_prop() {
local result=$(grep_prop $@)
if [ -z "$result" ]; then
# Fallback to getprop
getprop "$1"
else
echo $result
fi
}
getvar() {
local VARNAME=$1
local VALUE
@ -508,10 +518,10 @@ remove_system_su() {
}
api_level_arch_detect() {
API=`grep_prop ro.build.version.sdk`
ABI=`grep_prop ro.product.cpu.abi | cut -c-3`
ABI2=`grep_prop ro.product.cpu.abi2 | cut -c-3`
ABILONG=`grep_prop ro.product.cpu.abi`
API=$(grep_get_prop ro.build.version.sdk)
ABI=$(grep_get_prop ro.product.cpu.abi | cut -c-3)
ABI2=$(grep_get_prop ro.product.cpu.abi2 | cut -c-3)
ABILONG=$(grep_get_prop ro.product.cpu.abi)
ARCH=arm
ARCH32=arm