| 1 | #!/bin/bash |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com> |
| 4 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | |
| 6 | set -exu |
| 7 | |
| 8 | COLOR_BLUE='\033[0;34m' |
| 9 | COLOR_NONE='\033[0m' # No Color |
| 10 | |
| 11 | print_blue() { |
| 12 | echo -e "${COLOR_BLUE}$1${COLOR_NONE}" |
| 13 | } |
| 14 | |
| 15 | print_hardware() { |
| 16 | if command -v lscpu >/dev/null 2>&1; then |
| 17 | print_blue "CPU Details" |
| 18 | lscpu |
| 19 | fi |
| 20 | |
| 21 | print_blue "Memory Details" |
| 22 | free |
| 23 | |
| 24 | print_blue "Storage Details" |
| 25 | df -H -T |
| 26 | } |
| 27 | |
| 28 | print_os() { |
| 29 | set +ex |
| 30 | |
| 31 | print_blue "Operating System Details" |
| 32 | |
| 33 | if [ -f "/etc/os-release" ]; then |
| 34 | (. "/etc/os-release"; echo "Version: $NAME $VERSION") |
| 35 | elif [ -f "/etc/release" ]; then |
| 36 | echo "Version: $(head -n1 /etc/release)" |
| 37 | elif command -v sw_vers >/dev/null 2>&1; then |
| 38 | # For MacOS |
| 39 | echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)" |
| 40 | fi |
| 41 | |
| 42 | echo -n "Kernel: " |
| 43 | uname -a |
| 44 | |
| 45 | set -ex |
| 46 | } |
| 47 | |
| 48 | print_pkgconfig_mod() { |
| 49 | local mod=$1 |
| 50 | if pkg-config --exists "${mod}"; then |
| 51 | print_blue "$mod version" |
| 52 | pkg-config --modversion "${mod}" |
| 53 | fi |
| 54 | } |
| 55 | |
| 56 | print_tooling() { |
| 57 | set +ex |
| 58 | |
| 59 | print_blue "Selected CC version" |
| 60 | ${CC:-cc} --version | head -n1 |
| 61 | |
| 62 | print_blue "Selected CXX version" |
| 63 | ${CXX:-c++} --version | head -n1 |
| 64 | |
| 65 | print_blue "Default gcc version" |
| 66 | gcc --version | head -n1 |
| 67 | gcc -dumpmachine |
| 68 | |
| 69 | print_blue "Default g++ version" |
| 70 | g++ --version | head -n1 |
| 71 | g++ -dumpmachine |
| 72 | |
| 73 | if command -v clang >/dev/null 2>&1; then |
| 74 | print_blue "Default clang version" |
| 75 | clang --version |
| 76 | fi |
| 77 | |
| 78 | if command -v clang++ >/dev/null 2>&1; then |
| 79 | print_blue "Default clang++ version" |
| 80 | clang++ --version |
| 81 | fi |
| 82 | |
| 83 | print_blue "git version" |
| 84 | git --version |
| 85 | |
| 86 | print_blue "bash version" |
| 87 | bash --version | head -n1 |
| 88 | |
| 89 | print_blue "make version" |
| 90 | ${MAKE:-make} --version | head -n1 |
| 91 | |
| 92 | if command -v cmake >/dev/null 2>&1; then |
| 93 | print_blue "cmake version" |
| 94 | cmake --version |
| 95 | fi |
| 96 | |
| 97 | print_blue "automake version" |
| 98 | automake --version | head -n1 |
| 99 | |
| 100 | print_blue "autoconf version" |
| 101 | autoconf --version | head -n1 |
| 102 | |
| 103 | print_blue "libtool version" |
| 104 | if libtool --version >/dev/null 2>&1; then |
| 105 | libtool --version | head -n1 |
| 106 | else |
| 107 | # Thanks Apple! |
| 108 | libtool -V |
| 109 | fi |
| 110 | |
| 111 | print_blue "bison version" |
| 112 | ${BISON:-bison} --version | head -n1 |
| 113 | |
| 114 | print_blue "flex version" |
| 115 | ${FLEX:-flex} --version |
| 116 | |
| 117 | print_blue "swig version" |
| 118 | swig -version | ${GREP:-grep} SWIG |
| 119 | |
| 120 | print_blue "tar version" |
| 121 | ${TAR:-tar} --version | head -n1 |
| 122 | |
| 123 | print_blue "Selected python version" |
| 124 | ${PYTHON:-python} --version |
| 125 | |
| 126 | if command -v "${PYTHON2:-python2}" >/dev/null 2>&1; then |
| 127 | print_blue "python2 version" |
| 128 | ${PYTHON2:-python2} --version |
| 129 | fi |
| 130 | |
| 131 | if command -v "${PYTHON3:-python3}" >/dev/null 2>&1; then |
| 132 | print_blue "python3 version" |
| 133 | ${PYTHON3:-python3} --version |
| 134 | fi |
| 135 | |
| 136 | print_blue "java version" |
| 137 | java -version |
| 138 | |
| 139 | print_blue "javac version" |
| 140 | javac -version |
| 141 | |
| 142 | if command -v asciidoc >/dev/null 2>&1; then |
| 143 | print_blue "asciidoc version" |
| 144 | asciidoc --version |
| 145 | fi |
| 146 | |
| 147 | if command -v xmlto >/dev/null 2>&1; then |
| 148 | print_blue "xmlto version" |
| 149 | xmlto --version |
| 150 | fi |
| 151 | |
| 152 | if command -v openssl >/dev/null 2>&1; then |
| 153 | print_blue "openssl version" |
| 154 | openssl version |
| 155 | fi |
| 156 | |
| 157 | if command -v pkg-config >/dev/null 2>&1; then |
| 158 | print_blue "pkg-config version" |
| 159 | pkg-config --version |
| 160 | |
| 161 | #print_blue "pkg-config modules installed" |
| 162 | #pkg-config --list-all |
| 163 | |
| 164 | print_pkgconfig_mod glib-2.0 |
| 165 | print_pkgconfig_mod libdw |
| 166 | print_pkgconfig_mod libelf |
| 167 | print_pkgconfig_mod libxml-2.0 |
| 168 | print_pkgconfig_mod msgpack |
| 169 | print_pkgconfig_mod popt |
| 170 | print_pkgconfig_mod uuid |
| 171 | print_pkgconfig_mod zlib |
| 172 | fi |
| 173 | |
| 174 | set -ex |
| 175 | } |