blob: 0968a3070eff39fcb86fd6b37c7eb32acc56cea3 [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 Kapshuk2ca46ed2019-01-05 19:09:23 +020016 vernum = "[0-9]+([.]?[0-9]+)+"
Alexander Kapshukff5cd9a2020-02-09 16:00:57 +020017 libc = "libc[.]so[.][0-9]+$"
18 libcpp = "(libg|stdc)[+]+[.]so[.][0-9]+$"
Alexander Kapshuk2ca46ed2019-01-05 19:09:23 +020019
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030020 printversion("GNU C", version("gcc -dumpversion"))
21 printversion("GNU Make", version("make --version"))
22 printversion("Binutils", version("ld -v"))
23 printversion("Util-linux", version("mount --version"))
24 printversion("Mount", version("mount --version"))
25 printversion("Module-init-tools", version("depmod -V"))
26 printversion("E2fsprogs", version("tune2fs"))
27 printversion("Jfsutils", version("fsck.jfs -V"))
28 printversion("Reiserfsprogs", version("reiserfsck -V"))
29 printversion("Reiser4fsprogs", version("fsck.reiser4 -V"))
30 printversion("Xfsprogs", version("xfs_db -V"))
31 printversion("Pcmciautils", version("pccardctl -V"))
32 printversion("Pcmcia-cs", version("cardmgr -V"))
33 printversion("Quota-tools", version("quota -V"))
34 printversion("PPP", version("pppd --version"))
35 printversion("Isdn4k-utils", version("isdnctrl"))
36 printversion("Nfs-utils", version("showmount --version"))
Bhaskar Chowdhuryfaade962019-11-06 09:06:10 +053037 printversion("Bison", version("bison --version"))
38 printversion("Flex", version("flex --version"))
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030039
Alexander Kapshukff5cd9a2020-02-09 16:00:57 +020040 while ("ldconfig -p 2>/dev/null" | getline > 0) {
41 if ($NF ~ libc && !seen[ver = version("readlink " $NF)]++)
42 printversion("Linux C Library", ver)
43 else if ($NF ~ libcpp && !seen[ver = version("readlink " $NF)]++)
44 printversion("Linux C++ Library", ver)
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030045 }
46
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030047 printversion("Dynamic linker (ldd)", version("ldd --version"))
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030048 printversion("Procps", version("ps --version"))
49 printversion("Net-tools", version("ifconfig --version"))
50 printversion("Kbd", version("loadkeys -V"))
51 printversion("Console-tools", version("loadkeys -V"))
52 printversion("Oprofile", version("oprofiled --version"))
53 printversion("Sh-utils", version("expr --v"))
54 printversion("Udev", version("udevadm --version"))
55 printversion("Wireless-tools", version("iwconfig --version"))
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030056
Alexander Kapshuk1c9a4be52018-05-12 12:02:31 +030057 while ("sort /proc/modules" | getline > 0) {
58 mods = mods sep $1
59 sep = " "
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030060 }
Alexander Kapshuk1c9a4be52018-05-12 12:02:31 +030061 printversion("Modules Loaded", mods)
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030062}
63
64function version(cmd, ver) {
Alexander Kapshuk4169bc42018-05-12 12:02:30 +030065 cmd = cmd " 2>&1"
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030066 while (cmd | getline > 0) {
Alexander Kapshuk2ca46ed2019-01-05 19:09:23 +020067 if (match($0, vernum)) {
Alexander Kapshuk2d187d52016-08-22 21:19:17 +030068 ver = substr($0, RSTART, RLENGTH)
69 break
70 }
71 }
72 close(cmd)
73 return ver
74}
75
76function printversion(name, value, ofmt) {
77 if (value != "") {
78 ofmt = "%-20s\t%s\n"
79 printf(ofmt, name, value)
80 }
81}