• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
8
9tst_cmd_available()
10{
11	if type command > /dev/null 2>&1; then
12		command -v $1 > /dev/null 2>&1 || return 1
13	else
14		which $1 > /dev/null 2>&1
15		if [ $? -eq 0 ]; then
16			return 0
17		else
18			return 1
19		fi
20	fi
21}
22
23tst_cmd_run()
24{
25	local cmd="$1"
26	shift
27	tst_cmd_available $cmd && eval "$cmd $@"
28}
29
30is_enabled()
31{
32	[ -f "$1" ] && [ "$(cat $1)" = "Y" -o "$(cat $1)" = "1" ]
33}
34
35echo 'If some fields are empty or look unusual you may have an old version.'
36echo 'Compare to the current minimal requirements in Documentation/Changes.'
37
38echo
39echo "`ls /etc/*release 2> /dev/null`"
40cat /etc/*release 2> /dev/null
41if [ $? = 1 ]; then
42   echo "`ls /usr/lib/*release 2> /dev/null`"
43   cat /usr/lib/*release 2> /dev/null
44fi
45if [ $? = 1 ]; then
46   echo '/etc/issue:'
47   cat /etc/issue 2> /dev/null
48fi
49if [ $? = 1 ]; then
50	echo 'lsb_release -a'
51	lsb_release -a 2> /dev/null
52fi
53
54echo
55echo 'uname:'
56uname -a
57
58echo
59echo '/proc/cmdline'
60cat /proc/cmdline
61
62echo
63
64echo "Gnu C                 " `gcc --version 2>/dev/null | head -n 1`
65echo "Clang                 " `clang --version 2>/dev/null | head -n 1`
66
67make --version 2>&1 | awk -F, '{print $1}' | awk \
68      '/GNU Make/{print "Gnu make              ",$NF}'
69
70ld -v 2>&1 | awk -F\) '{print $1}' | awk \
71      '/BFD/{print "binutils              ",$NF}'
72
73mkswap -V 2>&1 | awk '{print "util-linux            ", $NF}'
74
75mount --version 2>&1 | awk -F\- '{print "mount                 ", $NF}'
76
77insmod -V  2>&1 | awk 'NR==1 {print "modutils              ",$NF}'
78
79tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' |  awk \
80'NR==1 {print "e2fsprogs             ", $2}'
81
82reiserfsck 2>&1 | grep reiserfsprogs | awk \
83'NR==1{print "reiserfsprogs         ", $NF}'
84
85cardmgr -V 2>&1| grep version | awk \
86'NR==1{print "pcmcia-cs             ", $3}'
87
88pppd --version 2>&1| grep version | awk \
89'NR==1{print "PPP                   ", $3}'
90
91isdnctrl 2>&1 | grep version | awk \
92'NR==1{print "isdn4k-utils          ", $NF}'
93
94ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
95-e 's/\.so$//' | awk -F'[.-]'   '{print "Linux C Library        " \
96$(NF-2)"."$(NF-1)"."$NF}'
97
98ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
99'NR==1{print "Dynamic linker (ldd)  ", $NF}'
100
101ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
102       '{print "Linux C++ Library      " $4"."$5"."$6}'
103
104ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'
105
106ifconfig --version 2>&1 | grep tools | awk \
107'NR==1{print "Net-tools             ", $NF}'
108
109ip -V 2>&1 | awk \
110'NR==1{print "iproute2              ", $NF}'
111
112ping -V 2>&1 | awk \
113'NR==1{print "iputils               ", $NF}'
114
115ethtool --version | grep version 2>&1 | awk \
116'NR==1{print "ethtool               ", $NF}'
117
118# Kbd needs 'loadkeys -h',
119loadkeys -h 2>&1 | awk \
120'(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
121
122# while console-tools needs 'loadkeys -V'.
123loadkeys -V 2>&1 | awk \
124'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
125
126expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
127
128if [ -e /proc/modules ]; then
129    X=`cat /proc/modules | sed -e "s/ .*$//"`
130    echo "Modules Loaded         "$X
131fi
132
133echo
134echo 'free reports:'
135free
136
137echo
138echo 'cpuinfo:'
139tst_cmd_run lscpu || cat /proc/cpuinfo
140
141echo
142if is_enabled /sys/module/apparmor/parameters/enabled; then
143	echo 'AppArmor enabled'
144	tst_cmd_run aa-status
145else
146	echo 'AppArmor disabled'
147fi
148
149echo
150
151if ! tst_cmd_run sestatus; then
152	printf 'SELinux mode: '
153	tst_cmd_run getenforce || echo 'unknown'
154fi
155