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