Add new model function to print device model name

This commit is contained in:
Dylan Araps 2016-08-14 13:26:30 +10:00
parent 3f983245bb
commit 6b9abdb9d6
2 changed files with 53 additions and 2 deletions

View File

@ -18,6 +18,7 @@ printinfo () {
info title info title
info underline info underline
info "Model" model
info "OS" distro info "OS" distro
info "Kernel" kernel info "Kernel" kernel
info "Uptime" uptime info "Uptime" uptime

View File

@ -36,6 +36,57 @@ getos() {
# }}} # }}}
# Model {{{
getmodel() {
case "$os" in
"Linux")
model="$(< /sys/devices/virtual/dmi/id/product_version)"
model="${model/To Be Filled*}"
;;
"iPhone OS")
case "${ios_model:-$(uname -m)}" in
"iPad1,1") model="iPad" ;;
"iPad2,"[1-4]) model="iPad2" ;;
"iPad3,"[1-3]) model="iPad3" ;;
"iPad3,"[4-6]) model="iPad4" ;;
"iPad4,"[1-3]) model="iPad Air" ;;
"iPad5,"[3-4]) model="iPad Air 2" ;;
"iPad6,"[7-8]) model="iPad Pro (12.9 Inch)" ;;
"iPad6,"[3-4]) model="iPad Pro (9.7 Inch)" ;;
"iPad2,"[5-7]) model="iPad mini" ;;
"iPad4,"[4-6]) model="iPad mini 2" ;;
"iPad4,"[7-9]) model="iPad mini 3" ;;
"iPad5,"[1-2]) model="iPad mini 4" ;;
"iPhone1,1") model="iPhone" ;;
"iPhone1,2") model="iPhone 3G" ;;
"iPhone2,1") model="iPhone 3GS" ;;
"iPhone3,"[1-3]) model="iPhone 4" ;;
"iPhone4,1") model="iPhone 4S" ;;
"iPhone5,"[1-2]) model="iPhone 4" ;;
"iPhone5,"[3-4]) model="iPhone 5c" ;;
"iPhone6,"[1-2]) model="iPhone 5s" ;;
"iPhone7,2") model="iPhone 6" ;;
"iPhone7,1") model="iPhone 6 Plus" ;;
"iPhone8,1") model="iPhone 6s" ;;
"iPhone8,2") model="iPhone 6s Plus" ;;
"iPhone8,4") model="iPhone SE" ;;
"iPod1,1") model="iPod touch" ;;
"ipod2,1") model="iPod touch 2G" ;;
"ipod3,1") model="iPod touch 3G" ;;
"ipod4,1") model="iPod touch 4G" ;;
"ipod5,1") model="iPod touch 5G" ;;
"ipod7,1") model="iPod touch 6G" ;;
esac
;;
esac
}
# }}}
# Distro {{{ # Distro {{{
getdistro() { getdistro() {
@ -587,8 +638,7 @@ getcpu() {
;; ;;
"iPhone OS") "iPhone OS")
ios_model="${ios_model:-$(uname -m)}" case "${ios_model:-$(uname -m)}" in
case "$ios_model" in
"iPhone1,1" | "iPhone1,2" | "iPod1,1") "iPhone1,1" | "iPhone1,2" | "iPod1,1")
cpu="Samsung S5L8900 @ 412MHz" cpu="Samsung S5L8900 @ 412MHz"
cores="1" cores="1"