Last active
October 27, 2015 01:38
-
-
Save kamawanu/6820f0bc061351d0dd14 to your computer and use it in GitHub Desktop.
tiny build prop parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# https://gist.github.com/kamawanu/6820f0bc061351d0dd14/ | |
# | |
# https://gist.githubusercontent.com/kamawanu/6820f0bc061351d0dd14/raw/_.awk | |
# | |
# adb shell cat /system/build.prop | awk -f $ITS | |
# | |
BEGIN { | |
FS="=" | |
} | |
/^#/ { $1 = $0 = "" } | |
{ | |
$2=tolower($2) | |
gsub(/\r/,"",$2); | |
gsub(/[^0-9a-zA-Z\-_]/,"_",$2) | |
gsub(/ /,"_",$2); | |
gsub(/_$/,"",$2); | |
} | |
$1 == "ro.build.id" { buildid = $2 } | |
$1 == "ro.build.version.release" { aosv = $2 } | |
$1 == "ro.product.cpu.abi" { cpu = $2 } | |
$1 == "ro.product.model" { model = $2 } | |
$1 == "ro.product.name" { mname = $2 } | |
$1 == "ro.product.brand" { brand = $2 } | |
$1 == "ro.product.manufacturer" { manuf = $2 } | |
$1 == "ro.build.version.sdk" { sdkv = $2 } | |
$1 == "ro.product.device" { bdev = $2 } | |
END { | |
if( manuf == brand ){ | |
brand="-"; | |
} | |
if( bdev == model ){ | |
model="-"; | |
} | |
print manuf,brand,bdev,model,cpu,aosv,sdkv,buildid | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment