ver_linux 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/awk -f
  2. # SPDX-License-Identifier: GPL-2.0
  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. BEGIN {
  8. usage = "If some fields are empty or look unusual you may have an old version.\n"
  9. usage = usage "Compare to the current minimal requirements in Documentation/Changes.\n"
  10. print usage
  11. system("uname -a")
  12. printf("\n")
  13. printversion("GNU C", version("gcc -dumpversion 2>&1"))
  14. printversion("GNU Make", version("make --version 2>&1"))
  15. printversion("Binutils", version("ld -v 2>&1"))
  16. printversion("Util-linux", version("mount --version 2>&1"))
  17. printversion("Mount", version("mount --version 2>&1"))
  18. printversion("Module-init-tools", version("depmod -V 2>&1"))
  19. printversion("E2fsprogs", version("tune2fs 2>&1"))
  20. printversion("Jfsutils", version("fsck.jfs -V 2>&1"))
  21. printversion("Reiserfsprogs", version("reiserfsck -V 2>&1"))
  22. printversion("Reiser4fsprogs", version("fsck.reiser4 -V 2>&1"))
  23. printversion("Xfsprogs", version("xfs_db -V 2>&1"))
  24. printversion("Pcmciautils", version("pccardctl -V 2>&1"))
  25. printversion("Pcmcia-cs", version("cardmgr -V 2>&1"))
  26. printversion("Quota-tools", version("quota -V 2>&1"))
  27. printversion("PPP", version("pppd --version 2>&1"))
  28. printversion("Isdn4k-utils", version("isdnctrl 2>&1"))
  29. printversion("Nfs-utils", version("showmount --version 2>&1"))
  30. if (system("test -r /proc/self/maps") == 0) {
  31. while (getline <"/proc/self/maps" > 0) {
  32. n = split($0, procmaps, "/")
  33. if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) {
  34. ver = substr(procmaps[n], RSTART, RLENGTH)
  35. printversion("Linux C Library", ver)
  36. break
  37. }
  38. }
  39. }
  40. printversion("Dynamic linker (ldd)", version("ldd --version 2>&1"))
  41. while ("ldconfig -p 2>/dev/null" | getline > 0) {
  42. if (/(libg|stdc)[+]+\.so/) {
  43. libcpp = $NF
  44. break
  45. }
  46. }
  47. if (system("test -r " libcpp) == 0)
  48. printversion("Linux C++ Library", version("readlink " libcpp))
  49. printversion("Procps", version("ps --version 2>&1"))
  50. printversion("Net-tools", version("ifconfig --version 2>&1"))
  51. printversion("Kbd", version("loadkeys -V 2>&1"))
  52. printversion("Console-tools", version("loadkeys -V 2>&1"))
  53. printversion("Oprofile", version("oprofiled --version 2>&1"))
  54. printversion("Sh-utils", version("expr --v 2>&1"))
  55. printversion("Udev", version("udevadm --version 2>&1"))
  56. printversion("Wireless-tools", version("iwconfig --version 2>&1"))
  57. if (system("test -r /proc/modules") == 0) {
  58. while ("sort /proc/modules" | getline > 0) {
  59. mods = mods sep $1
  60. sep = " "
  61. }
  62. printversion("Modules Loaded", mods)
  63. }
  64. }
  65. function version(cmd, ver) {
  66. while (cmd | getline > 0) {
  67. if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) {
  68. ver = substr($0, RSTART, RLENGTH)
  69. break
  70. }
  71. }
  72. close(cmd)
  73. return ver
  74. }
  75. function printversion(name, value, ofmt) {
  76. if (value != "") {
  77. ofmt = "%-20s\t%s\n"
  78. printf(ofmt, name, value)
  79. }
  80. }