From d0cd21c01e3e73dc4af5026d8b25d31c11d3eb81 Mon Sep 17 00:00:00 2001 From: jkhsjdhjs Date: Wed, 13 Mar 2019 19:02:18 +0100 Subject: [PATCH] cache_uname: improve reading from 'SystemVersion.plist' on macOS and iOS and thus fix neofetch for iOS 11.3+ --- neofetch | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 55e53238..1063a950 100755 --- a/neofetch +++ b/neofetch @@ -4199,11 +4199,16 @@ cache_uname() { kernel_machine="${uname[2]}" 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") - darwin_name="${sw_vers[2]}" - osx_version="${sw_vers[3]}" - osx_build="${sw_vers[0]}" + for i in "${!sw_vers[@]}"; do + local value="${sw_vers[(( $i + 1 ))]}" + case "${sw_vers[$i]}" in + "ProductName") darwin_name="$value" ;; + "ProductVersion") osx_version="$value" ;; + "ProductBuildVersion") osx_build="$value" ;; + esac + done fi }