8af11c1cdd8fa scripts/ver_linux (Saul Wold 2017-03-28 15:06:08 -0700 1) #!/usr/bin/awk -f
b24413180f560 scripts/ver_linux (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 2) # SPDX-License-Identifier: GPL-2.0
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 3) # Before running this script please ensure that your PATH is
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 4) # typical as you use for compilation/installation. I use
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 5) # /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 6) # differ on your system.
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 7)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 8) BEGIN {
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 9) usage = "If some fields are empty or look unusual you may have an old version.\n"
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 10) usage = usage "Compare to the current minimal requirements in Documentation/Changes.\n"
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 11) print usage
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 12)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 13) system("uname -a")
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 14) printf("\n")
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 15)
2ca46ed207d5d scripts/ver_linux (Alexander Kapshuk 2019-01-05 19:09:23 +0200 16) vernum = "[0-9]+([.]?[0-9]+)+"
ff5cd9accbc72 scripts/ver_linux (Alexander Kapshuk 2020-02-09 16:00:57 +0200 17) libc = "libc[.]so[.][0-9]+$"
afe9017901761 scripts/ver_linux (Alexander Kapshuk 2021-01-08 13:26:26 +0200 18) libcpp = "(libg|stdc)[+]+[.]so([.][0-9]+)+$"
2ca46ed207d5d scripts/ver_linux (Alexander Kapshuk 2019-01-05 19:09:23 +0200 19)
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 20) printversion("GNU C", version("gcc -dumpversion"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 21) printversion("GNU Make", version("make --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 22) printversion("Binutils", version("ld -v"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 23) printversion("Util-linux", version("mount --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 24) printversion("Mount", version("mount --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 25) printversion("Module-init-tools", version("depmod -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 26) printversion("E2fsprogs", version("tune2fs"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 27) printversion("Jfsutils", version("fsck.jfs -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 28) printversion("Reiserfsprogs", version("reiserfsck -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 29) printversion("Reiser4fsprogs", version("fsck.reiser4 -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 30) printversion("Xfsprogs", version("xfs_db -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 31) printversion("Pcmciautils", version("pccardctl -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 32) printversion("Pcmcia-cs", version("cardmgr -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 33) printversion("Quota-tools", version("quota -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 34) printversion("PPP", version("pppd --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 35) printversion("Isdn4k-utils", version("isdnctrl"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 36) printversion("Nfs-utils", version("showmount --version"))
faade9610246e scripts/ver_linux (Bhaskar Chowdhury 2019-11-06 09:06:10 +0530 37) printversion("Bison", version("bison --version"))
faade9610246e scripts/ver_linux (Bhaskar Chowdhury 2019-11-06 09:06:10 +0530 38) printversion("Flex", version("flex --version"))
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 39)
afe9017901761 scripts/ver_linux (Alexander Kapshuk 2021-01-08 13:26:26 +0200 40) while ("ldconfig -p 2>/dev/null" | getline > 0)
afe9017901761 scripts/ver_linux (Alexander Kapshuk 2021-01-08 13:26:26 +0200 41) if ($NF ~ libc || $NF ~ libcpp)
afe9017901761 scripts/ver_linux (Alexander Kapshuk 2021-01-08 13:26:26 +0200 42) if (!seen[ver = version("readlink " $NF)]++)
afe9017901761 scripts/ver_linux (Alexander Kapshuk 2021-01-08 13:26:26 +0200 43) printversion("Linux C" ($NF ~ libcpp? "++" : "") " Library", ver)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 44)
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 45) printversion("Dynamic linker (ldd)", version("ldd --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 46) printversion("Procps", version("ps --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 47) printversion("Net-tools", version("ifconfig --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 48) printversion("Kbd", version("loadkeys -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 49) printversion("Console-tools", version("loadkeys -V"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 50) printversion("Sh-utils", version("expr --v"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 51) printversion("Udev", version("udevadm --version"))
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 52) printversion("Wireless-tools", version("iwconfig --version"))
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 53)
1c9a4be514e7a scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:31 +0300 54) while ("sort /proc/modules" | getline > 0) {
1c9a4be514e7a scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:31 +0300 55) mods = mods sep $1
1c9a4be514e7a scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:31 +0300 56) sep = " "
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 57) }
1c9a4be514e7a scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:31 +0300 58) printversion("Modules Loaded", mods)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 59) }
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 60)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 61) function version(cmd, ver) {
4169bc43dbdd6 scripts/ver_linux (Alexander Kapshuk 2018-05-12 12:02:30 +0300 62) cmd = cmd " 2>&1"
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 63) while (cmd | getline > 0) {
2ca46ed207d5d scripts/ver_linux (Alexander Kapshuk 2019-01-05 19:09:23 +0200 64) if (match($0, vernum)) {
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 65) ver = substr($0, RSTART, RLENGTH)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 66) break
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 67) }
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 68) }
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 69) close(cmd)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 70) return ver
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 71) }
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 72)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 73) function printversion(name, value, ofmt) {
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 74) if (value != "") {
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 75) ofmt = "%-20s\t%s\n"
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 76) printf(ofmt, name, value)
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 77) }
2d187d58553be scripts/ver_linux.awk (Alexander Kapshuk 2016-08-22 21:19:17 +0300 78) }