blob: 0b301bd1637dfff0c0a315fd96e24db7254d55dd [file] [log] [blame]
Saul Wold8af11c12017-03-28 15:06:08 -07001#!/usr/bin/awk -f
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01002# SPDX-License-Identifier: GPL-2.0
Alexander Kapshuk2d187d52016-08-22 21:19:17 +03003# Before running this script please ensure that your PATH is
4# typical as you use for compilation/installation. I use
5# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
6# differ on your system.
7
8BEGIN {
9 usage = "If some fields are empty or look unusual you may have an old version.\n"
10 usage = usage "Compare to the current minimal requirements in Documentation/Changes.\n"
11 print usage
12
13 system("uname -a")
14 printf("\n")
15
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030016 printversion("GNU C", version("gcc -dumpversion"))
17 printversion("GNU Make", version("make --version"))
18 printversion("Binutils", version("ld -v"))
19 printversion("Util-linux", version("mount --version"))
20 printversion("Mount", version("mount --version"))
21 printversion("Module-init-tools", version("depmod -V"))
22 printversion("E2fsprogs", version("tune2fs"))
23 printversion("Jfsutils", version("fsck.jfs -V"))
24 printversion("Reiserfsprogs", version("reiserfsck -V"))
25 printversion("Reiser4fsprogs", version("fsck.reiser4 -V"))
26 printversion("Xfsprogs", version("xfs_db -V"))
27 printversion("Pcmciautils", version("pccardctl -V"))
28 printversion("Pcmcia-cs", version("cardmgr -V"))
29 printversion("Quota-tools", version("quota -V"))
30 printversion("PPP", version("pppd --version"))
31 printversion("Isdn4k-utils", version("isdnctrl"))
32 printversion("Nfs-utils", version("showmount --version"))
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030033
34 if (system("test -r /proc/self/maps") == 0) {
35 while (getline <"/proc/self/maps" > 0) {
36 n = split($0, procmaps, "/")
37 if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) {
38 ver = substr(procmaps[n], RSTART, RLENGTH)
39 printversion("Linux C Library", ver)
40 break
41 }
42 }
43 }
44
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030045 printversion("Dynamic linker (ldd)", version("ldd --version"))
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030046
47 while ("ldconfig -p 2>/dev/null" | getline > 0) {
48 if (/(libg|stdc)[+]+\.so/) {
49 libcpp = $NF
50 break
51 }
52 }
53 if (system("test -r " libcpp) == 0)
54 printversion("Linux C++ Library", version("readlink " libcpp))
55
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030056 printversion("Procps", version("ps --version"))
57 printversion("Net-tools", version("ifconfig --version"))
58 printversion("Kbd", version("loadkeys -V"))
59 printversion("Console-tools", version("loadkeys -V"))
60 printversion("Oprofile", version("oprofiled --version"))
61 printversion("Sh-utils", version("expr --v"))
62 printversion("Udev", version("udevadm --version"))
63 printversion("Wireless-tools", version("iwconfig --version"))
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030064
65 if (system("test -r /proc/modules") == 0) {
66 while ("sort /proc/modules" | getline > 0) {
67 mods = mods sep $1
68 sep = " "
69 }
70 printversion("Modules Loaded", mods)
71 }
72}
73
74function version(cmd, ver) {
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030075 cmd = cmd " 2>&1"
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030076 while (cmd | getline > 0) {
77 if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) {
78 ver = substr($0, RSTART, RLENGTH)
79 break
80 }
81 }
82 close(cmd)
83 return ver
84}
85
86function printversion(name, value, ofmt) {
87 if (value != "") {
88 ofmt = "%-20s\t%s\n"
89 printf(ofmt, name, value)
90 }
91}