blob: 545ec7388eb71d3a83cbb508787ca38f5d6601bb [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
16 printversion("GNU C", version("gcc -dumpversion 2>&1"))
17 printversion("GNU Make", version("make --version 2>&1"))
18 printversion("Binutils", version("ld -v 2>&1"))
19 printversion("Util-linux", version("mount --version 2>&1"))
20 printversion("Mount", version("mount --version 2>&1"))
21 printversion("Module-init-tools", version("depmod -V 2>&1"))
22 printversion("E2fsprogs", version("tune2fs 2>&1"))
23 printversion("Jfsutils", version("fsck.jfs -V 2>&1"))
24 printversion("Reiserfsprogs", version("reiserfsck -V 2>&1"))
25 printversion("Reiser4fsprogs", version("fsck.reiser4 -V 2>&1"))
26 printversion("Xfsprogs", version("xfs_db -V 2>&1"))
27 printversion("Pcmciautils", version("pccardctl -V 2>&1"))
28 printversion("Pcmcia-cs", version("cardmgr -V 2>&1"))
29 printversion("Quota-tools", version("quota -V 2>&1"))
30 printversion("PPP", version("pppd --version 2>&1"))
31 printversion("Isdn4k-utils", version("isdnctrl 2>&1"))
32 printversion("Nfs-utils", version("showmount --version 2>&1"))
33
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
45 printversion("Dynamic linker (ldd)", version("ldd --version 2>&1"))
46
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
56 printversion("Procps", version("ps --version 2>&1"))
57 printversion("Net-tools", version("ifconfig --version 2>&1"))
58 printversion("Kbd", version("loadkeys -V 2>&1"))
59 printversion("Console-tools", version("loadkeys -V 2>&1"))
60 printversion("Oprofile", version("oprofiled --version 2>&1"))
61 printversion("Sh-utils", version("expr --v 2>&1"))
62 printversion("Udev", version("udevadm --version 2>&1"))
63 printversion("Wireless-tools", version("iwconfig --version 2>&1"))
64
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) {
75 while (cmd | getline > 0) {
76 if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) {
77 ver = substr($0, RSTART, RLENGTH)
78 break
79 }
80 }
81 close(cmd)
82 return ver
83}
84
85function printversion(name, value, ofmt) {
86 if (value != "") {
87 ofmt = "%-20s\t%s\n"
88 printf(ofmt, name, value)
89 }
90}