ver_linux 2.9 KB

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