xref: /linux-6.15/scripts/ver_linux (revision 63e781ad)
1#!/bin/sh
2# Before running this script please ensure that your PATH is
3# typical as you use for compilation/istallation. I use
4# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
5# differ on your system.
6#
7echo 'If some fields are empty or look unusual you may have an old version.'
8echo 'Compare to the current minimal requirements in Documentation/Changes.'
9echo ' '
10
11uname -a
12echo ' '
13
14gcc -dumpversion 2>&1 |
15awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
16	match($0, /[0-9]+([.]?[0-9]+)+/)
17	printf("GNU C\t\t\t%s\n",
18	substr($0,RSTART,RLENGTH))
19}'
20
21make --version 2>&1 |
22awk '/GNU Make/{
23	match($0, /[0-9]+([.]?[0-9]+)+/)
24	printf("GNU Make\t\t%s\n",
25	substr($0,RSTART,RLENGTH))
26}'
27
28ld -v 2>&1 |
29awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
30	match($0, /[0-9]+([.]?[0-9]+)+/)
31	printf("Binutils\t\t%s\n",
32	substr($0,RSTART,RLENGTH))
33}'
34
35mount --version 2>&1 |
36awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
37	match($0, /[0-9]+([.]?[0-9]+)+/)
38	$0 = substr($0,RSTART,RLENGTH)
39	printf("Util-linux\t\t%s\nMount\t\t\t%s\n",$0,$0)
40}'
41
42depmod -V  2>&1 |
43awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
44	match($0, /[0-9]+([.]?[0-9]+)+/)
45	printf("Module-init-tools\t%s\n",
46	substr($0,RSTART,RLENGTH))
47}'
48
49tune2fs 2>&1 |
50awk '/^tune2fs/{
51	match($0, /[0-9]+([.]?[0-9]+)+/)
52	printf("E2fsprogs\t\t%s\n",
53	substr($0,RSTART,RLENGTH))
54}'
55
56fsck.jfs -V 2>&1 |
57awk '/version/{
58	match($0, /[0-9]+([.]?[0-9]+)+/)
59	printf("Jfsutils\t\t%s\n",
60	substr($0,RSTART,RLENGTH))
61}'
62
63reiserfsck -V 2>&1 |
64awk '/^reiserfsck/{
65	match($0, /[0-9]+([.]?[0-9]+)+/)
66	printf("Reiserfsprogs\t\t%s\n",
67	substr($0,RSTART,RLENGTH))
68}'
69
70fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
71'NR==1{print "reiser4progs          ", $2}'
72
73xfs_db -V 2>&1 | grep version | awk \
74'NR==1{print "xfsprogs              ", $3}'
75
76pccardctl -V 2>&1| grep pcmciautils | awk '{print "pcmciautils           ", $2}'
77
78cardmgr -V 2>&1| grep version | awk \
79'NR==1{print "pcmcia-cs             ", $3}'
80
81quota -V 2>&1 | grep version | awk \
82'NR==1{print "quota-tools           ", $NF}'
83
84pppd --version 2>&1| grep version | awk \
85'NR==1{print "PPP                   ", $3}'
86
87isdnctrl 2>&1 | grep version | awk \
88'NR==1{print "isdn4k-utils          ", $NF}'
89
90showmount --version 2>&1 | grep nfs-utils | awk \
91'NR==1{print "nfs-utils             ", $NF}'
92
93echo -n "Linux C Library        "
94sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
95
96ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
97'NR==1{print "Dynamic linker (ldd)  ", $NF}'
98
99ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so  2>/dev/null | awk -F. \
100       '{print "Linux C++ Library      " $4"."$5"."$6}'
101
102ps --version 2>&1 | grep version | awk \
103'NR==1{print "Procps                ", $NF}'
104
105ifconfig --version 2>&1 | grep tools | awk \
106'NR==1{print "Net-tools             ", $NF}'
107
108# Kbd needs 'loadkeys -h',
109loadkeys -h 2>&1 | awk \
110'(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
111
112# while console-tools needs 'loadkeys -V'.
113loadkeys -V 2>&1 | awk \
114'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
115
116oprofiled --version 2>&1 | awk \
117'(NR==1 && ($2 == "oprofile")) {print "oprofile              ", $3}'
118
119expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
120
121udevinfo -V 2>&1 | grep version | awk '{print "udev                  ", $3}'
122
123iwconfig --version 2>&1 | awk \
124'(NR==1 && ($3 == "version")) {print "wireless-tools        ",$4}'
125
126if [ -e /proc/modules ]; then
127    X=`cat /proc/modules | sed -e "s/ .*$//"`
128    echo "Modules Loaded         "$X
129fi
130