From bca720fa9549f7fe4687acd1aaf91720428657e9 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 9 Jul 2015 20:50:57 -0400 Subject: [PATCH] diagnostics: include detailed OS version info if possible --- lib/diagnostics.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh index f5f15deaa..53c6548de 100644 --- a/lib/diagnostics.zsh +++ b/lib/diagnostics.zsh @@ -55,6 +55,8 @@ function omz_diagnostic_dump() { emulate -L zsh + builtin echo "Generating diagnostic dump; please be patient..." + local thisfcn=omz_diagnostic_dump local -A opts local opt_verbose opt_noverbose opt_outfile @@ -108,6 +110,8 @@ function _omz_diag_dump_one_big_text() { builtin echo User: $USER builtin echo umask: $(umask) builtin echo + _omz_diag_dump_os_specific_version + builtin echo # Installed programs programs=(sh zsh ksh bash sed cat grep ls find git posh) @@ -299,4 +303,28 @@ function _omz_diag_dump_echo_file_w_header() { fi } +function _omz_diag_dump_os_specific_version() { + local osname osver version_file version_files + case "$OSTYPE" in + darwin*) + osname=$(command sw_vers -productName) + osver=$(command sw_vers -productVersion) + builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)" + ;; + cygwin) + command systeminfo | command grep "^OS Name\|^OS Version" + ;; + esac + + if builtin which lsb_release >/dev/null; then + builtin echo "OS Release: $(command lsb_release -s -d)" + fi + + version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) ) + for version_file in $version_files; do + builtin echo "$version_file:" + command cat "$version_file" + builtin echo + done +}