18af11c1cSSaul Wold#!/usr/bin/awk -f 2b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 39b9e7d36SAlexander Kapshuk# Before running this script please ensure that your PATH is 49b9e7d36SAlexander Kapshuk# typical as you use for compilation/installation. I use 59b9e7d36SAlexander Kapshuk# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may 69b9e7d36SAlexander Kapshuk# differ on your system. 79b9e7d36SAlexander Kapshuk 89b9e7d36SAlexander KapshukBEGIN { 99b9e7d36SAlexander Kapshuk usage = "If some fields are empty or look unusual you may have an old version.\n" 109b9e7d36SAlexander Kapshuk usage = usage "Compare to the current minimal requirements in Documentation/Changes.\n" 119b9e7d36SAlexander Kapshuk print usage 129b9e7d36SAlexander Kapshuk 139b9e7d36SAlexander Kapshuk system("uname -a") 149b9e7d36SAlexander Kapshuk printf("\n") 159b9e7d36SAlexander Kapshuk 16*4169bc43SAlexander Kapshuk printversion("GNU C", version("gcc -dumpversion")) 17*4169bc43SAlexander Kapshuk printversion("GNU Make", version("make --version")) 18*4169bc43SAlexander Kapshuk printversion("Binutils", version("ld -v")) 19*4169bc43SAlexander Kapshuk printversion("Util-linux", version("mount --version")) 20*4169bc43SAlexander Kapshuk printversion("Mount", version("mount --version")) 21*4169bc43SAlexander Kapshuk printversion("Module-init-tools", version("depmod -V")) 22*4169bc43SAlexander Kapshuk printversion("E2fsprogs", version("tune2fs")) 23*4169bc43SAlexander Kapshuk printversion("Jfsutils", version("fsck.jfs -V")) 24*4169bc43SAlexander Kapshuk printversion("Reiserfsprogs", version("reiserfsck -V")) 25*4169bc43SAlexander Kapshuk printversion("Reiser4fsprogs", version("fsck.reiser4 -V")) 26*4169bc43SAlexander Kapshuk printversion("Xfsprogs", version("xfs_db -V")) 27*4169bc43SAlexander Kapshuk printversion("Pcmciautils", version("pccardctl -V")) 28*4169bc43SAlexander Kapshuk printversion("Pcmcia-cs", version("cardmgr -V")) 29*4169bc43SAlexander Kapshuk printversion("Quota-tools", version("quota -V")) 30*4169bc43SAlexander Kapshuk printversion("PPP", version("pppd --version")) 31*4169bc43SAlexander Kapshuk printversion("Isdn4k-utils", version("isdnctrl")) 32*4169bc43SAlexander Kapshuk printversion("Nfs-utils", version("showmount --version")) 339b9e7d36SAlexander Kapshuk 349b9e7d36SAlexander Kapshuk if (system("test -r /proc/self/maps") == 0) { 359b9e7d36SAlexander Kapshuk while (getline <"/proc/self/maps" > 0) { 369b9e7d36SAlexander Kapshuk n = split($0, procmaps, "/") 379b9e7d36SAlexander Kapshuk if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { 389b9e7d36SAlexander Kapshuk ver = substr(procmaps[n], RSTART, RLENGTH) 399b9e7d36SAlexander Kapshuk printversion("Linux C Library", ver) 409b9e7d36SAlexander Kapshuk break 419b9e7d36SAlexander Kapshuk } 429b9e7d36SAlexander Kapshuk } 439b9e7d36SAlexander Kapshuk } 449b9e7d36SAlexander Kapshuk 45*4169bc43SAlexander Kapshuk printversion("Dynamic linker (ldd)", version("ldd --version")) 469b9e7d36SAlexander Kapshuk 479b9e7d36SAlexander Kapshuk while ("ldconfig -p 2>/dev/null" | getline > 0) { 489b9e7d36SAlexander Kapshuk if (/(libg|stdc)[+]+\.so/) { 499b9e7d36SAlexander Kapshuk libcpp = $NF 509b9e7d36SAlexander Kapshuk break 519b9e7d36SAlexander Kapshuk } 529b9e7d36SAlexander Kapshuk } 539b9e7d36SAlexander Kapshuk if (system("test -r " libcpp) == 0) 549b9e7d36SAlexander Kapshuk printversion("Linux C++ Library", version("readlink " libcpp)) 559b9e7d36SAlexander Kapshuk 56*4169bc43SAlexander Kapshuk printversion("Procps", version("ps --version")) 57*4169bc43SAlexander Kapshuk printversion("Net-tools", version("ifconfig --version")) 58*4169bc43SAlexander Kapshuk printversion("Kbd", version("loadkeys -V")) 59*4169bc43SAlexander Kapshuk printversion("Console-tools", version("loadkeys -V")) 60*4169bc43SAlexander Kapshuk printversion("Oprofile", version("oprofiled --version")) 61*4169bc43SAlexander Kapshuk printversion("Sh-utils", version("expr --v")) 62*4169bc43SAlexander Kapshuk printversion("Udev", version("udevadm --version")) 63*4169bc43SAlexander Kapshuk printversion("Wireless-tools", version("iwconfig --version")) 649b9e7d36SAlexander Kapshuk 659b9e7d36SAlexander Kapshuk if (system("test -r /proc/modules") == 0) { 669b9e7d36SAlexander Kapshuk while ("sort /proc/modules" | getline > 0) { 679b9e7d36SAlexander Kapshuk mods = mods sep $1 689b9e7d36SAlexander Kapshuk sep = " " 699b9e7d36SAlexander Kapshuk } 709b9e7d36SAlexander Kapshuk printversion("Modules Loaded", mods) 719b9e7d36SAlexander Kapshuk } 729b9e7d36SAlexander Kapshuk} 739b9e7d36SAlexander Kapshuk 749b9e7d36SAlexander Kapshukfunction version(cmd, ver) { 75*4169bc43SAlexander Kapshuk cmd = cmd " 2>&1" 769b9e7d36SAlexander Kapshuk while (cmd | getline > 0) { 779b9e7d36SAlexander Kapshuk if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) { 789b9e7d36SAlexander Kapshuk ver = substr($0, RSTART, RLENGTH) 799b9e7d36SAlexander Kapshuk break 809b9e7d36SAlexander Kapshuk } 819b9e7d36SAlexander Kapshuk } 829b9e7d36SAlexander Kapshuk close(cmd) 839b9e7d36SAlexander Kapshuk return ver 849b9e7d36SAlexander Kapshuk} 859b9e7d36SAlexander Kapshuk 869b9e7d36SAlexander Kapshukfunction printversion(name, value, ofmt) { 879b9e7d36SAlexander Kapshuk if (value != "") { 889b9e7d36SAlexander Kapshuk ofmt = "%-20s\t%s\n" 899b9e7d36SAlexander Kapshuk printf(ofmt, name, value) 909b9e7d36SAlexander Kapshuk } 919b9e7d36SAlexander Kapshuk} 92