bca720fa9549f7fe4687acd1aaf91720428657e9

Author
Andrew Janke <andrew@apjanke.net>
Committer
Andrew Janke <andrew@apjanke.net>
Date

Message

diagnostics: include detailed OS version info if possible

Diff

 1diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
 2index f5f15deaaf5f883510e2ca93e8ae31e6fbaa2c44..53c6548deaf9c77981198a8d22c7fd14dd357a57 100644
 3--- a/lib/diagnostics.zsh
 4+++ b/lib/diagnostics.zsh
 5@@ -55,6 +55,8 @@
 6 function omz_diagnostic_dump() {
 7   emulate -L zsh
 8 
 9+  builtin echo "Generating diagnostic dump; please be patient..."
10+  
11   local thisfcn=omz_diagnostic_dump
12   local -A opts
13   local opt_verbose opt_noverbose opt_outfile
14@@ -108,6 +110,8 @@ function _omz_diag_dump_one_big_text() {
15   builtin echo User: $USER
16   builtin echo umask: $(umask)
17   builtin echo
18+  _omz_diag_dump_os_specific_version
19+  builtin echo
20 
21   # Installed programs
22   programs=(sh zsh ksh bash sed cat grep ls find git posh)
23@@ -299,4 +303,28 @@ function _omz_diag_dump_echo_file_w_header() {
24   fi
25 }
26 
27+function _omz_diag_dump_os_specific_version() {
28+  local osname osver version_file version_files
29+  case "$OSTYPE" in
30+    darwin*)
31+      osname=$(command sw_vers -productName)
32+      osver=$(command sw_vers -productVersion)      
33+      builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
34+      ;;
35+    cygwin)
36+      command systeminfo | command grep "^OS Name\|^OS Version"
37+      ;;
38+  esac
39+
40+  if builtin which lsb_release >/dev/null; then
41+    builtin echo "OS Release: $(command lsb_release -s -d)"
42+  fi
43+
44+  version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) )
45+  for version_file in $version_files; do
46+    builtin echo "$version_file:"
47+    command cat "$version_file"
48+    builtin echo
49+  done
50+}
51