cache_uname: improve reading from 'SystemVersion.plist' on macOS and iOS
and thus fix neofetch for iOS 11.3+
This commit is contained in:
parent
cc78503b58
commit
d0cd21c01e
1 changed files with 9 additions and 4 deletions
13
neofetch
13
neofetch
|
@ -4199,11 +4199,16 @@ cache_uname() {
|
||||||
kernel_machine="${uname[2]}"
|
kernel_machine="${uname[2]}"
|
||||||
|
|
||||||
if [[ "$kernel_name" == "Darwin" ]]; then
|
if [[ "$kernel_name" == "Darwin" ]]; then
|
||||||
IFS=$'\n' read -d "" -ra sw_vers < <(awk -F'<|>' '/string/ {print $3}' \
|
IFS=$'\n' read -d "" -ra sw_vers < <(awk -F'<|>' '/key|string/ {print $3}' \
|
||||||
"/System/Library/CoreServices/SystemVersion.plist")
|
"/System/Library/CoreServices/SystemVersion.plist")
|
||||||
darwin_name="${sw_vers[2]}"
|
for i in "${!sw_vers[@]}"; do
|
||||||
osx_version="${sw_vers[3]}"
|
local value="${sw_vers[(( $i + 1 ))]}"
|
||||||
osx_build="${sw_vers[0]}"
|
case "${sw_vers[$i]}" in
|
||||||
|
"ProductName") darwin_name="$value" ;;
|
||||||
|
"ProductVersion") osx_version="$value" ;;
|
||||||
|
"ProductBuildVersion") osx_build="$value" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue