Saul Wold | 8af11c1 | 2017-03-28 15:06:08 -0700 | [diff] [blame] | 1 | #!/usr/bin/awk -f |
Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0 |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 3 | # 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 | |
| 8 | BEGIN { |
| 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 Kapshuk | 4169bc4 | 2018-05-12 12:02:30 +0300 | [diff] [blame] | 16 | 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 Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 33 | |
Alexander Kapshuk | 1c9a4be5 | 2018-05-12 12:02:31 +0300 | [diff] [blame] | 34 | while (getline <"/proc/self/maps" > 0) { |
Alexander Kapshuk | 34fe3cf | 2018-05-31 22:22:46 +0300 | [diff] [blame] | 35 | if (/libc.*\.so$/) { |
| 36 | n = split($0, procmaps, "/") |
| 37 | if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { |
| 38 | ver = substr(procmaps[n], RSTART, RLENGTH) |
| 39 | printversion("Linux C Library", ver) |
| 40 | break |
| 41 | } |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | |
Alexander Kapshuk | 4169bc4 | 2018-05-12 12:02:30 +0300 | [diff] [blame] | 45 | printversion("Dynamic linker (ldd)", version("ldd --version")) |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 46 | |
| 47 | while ("ldconfig -p 2>/dev/null" | getline > 0) { |
| 48 | if (/(libg|stdc)[+]+\.so/) { |
| 49 | libcpp = $NF |
| 50 | break |
| 51 | } |
| 52 | } |
Alexander Kapshuk | 1c9a4be5 | 2018-05-12 12:02:31 +0300 | [diff] [blame] | 53 | printversion("Linux C++ Library", version("readlink " libcpp)) |
Alexander Kapshuk | 4169bc4 | 2018-05-12 12:02:30 +0300 | [diff] [blame] | 54 | printversion("Procps", version("ps --version")) |
| 55 | printversion("Net-tools", version("ifconfig --version")) |
| 56 | printversion("Kbd", version("loadkeys -V")) |
| 57 | printversion("Console-tools", version("loadkeys -V")) |
| 58 | printversion("Oprofile", version("oprofiled --version")) |
| 59 | printversion("Sh-utils", version("expr --v")) |
| 60 | printversion("Udev", version("udevadm --version")) |
| 61 | printversion("Wireless-tools", version("iwconfig --version")) |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 62 | |
Alexander Kapshuk | 1c9a4be5 | 2018-05-12 12:02:31 +0300 | [diff] [blame] | 63 | while ("sort /proc/modules" | getline > 0) { |
| 64 | mods = mods sep $1 |
| 65 | sep = " " |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 66 | } |
Alexander Kapshuk | 1c9a4be5 | 2018-05-12 12:02:31 +0300 | [diff] [blame] | 67 | printversion("Modules Loaded", mods) |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | function version(cmd, ver) { |
Alexander Kapshuk | 4169bc4 | 2018-05-12 12:02:30 +0300 | [diff] [blame] | 71 | cmd = cmd " 2>&1" |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 72 | while (cmd | getline > 0) { |
Alexander Kapshuk | 71bdd87 | 2018-05-31 22:22:47 +0300 | [diff] [blame] | 73 | if (match($0, /[0-9]+([.]?[0-9]+)+/)) { |
Alexander Kapshuk | 2d187d5 | 2016-08-22 21:19:17 +0300 | [diff] [blame] | 74 | ver = substr($0, RSTART, RLENGTH) |
| 75 | break |
| 76 | } |
| 77 | } |
| 78 | close(cmd) |
| 79 | return ver |
| 80 | } |
| 81 | |
| 82 | function printversion(name, value, ofmt) { |
| 83 | if (value != "") { |
| 84 | ofmt = "%-20s\t%s\n" |
| 85 | printf(ofmt, name, value) |
| 86 | } |
| 87 | } |