1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh 2*49cdfc7eSAndroid Build Coastguard Worker# Before running this script please ensure that your PATH is 3*49cdfc7eSAndroid Build Coastguard Worker# typical as you use for compilation/istallation. I use 4*49cdfc7eSAndroid Build Coastguard Worker# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may 5*49cdfc7eSAndroid Build Coastguard Worker# differ on your system. 6*49cdfc7eSAndroid Build Coastguard Worker 7*49cdfc7eSAndroid Build Coastguard WorkerPATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH 8*49cdfc7eSAndroid Build Coastguard Worker 9*49cdfc7eSAndroid Build Coastguard Workertst_cmd_available() 10*49cdfc7eSAndroid Build Coastguard Worker{ 11*49cdfc7eSAndroid Build Coastguard Worker if type command > /dev/null 2>&1; then 12*49cdfc7eSAndroid Build Coastguard Worker command -v $1 > /dev/null 2>&1 || return 1 13*49cdfc7eSAndroid Build Coastguard Worker else 14*49cdfc7eSAndroid Build Coastguard Worker which $1 > /dev/null 2>&1 15*49cdfc7eSAndroid Build Coastguard Worker if [ $? -eq 0 ]; then 16*49cdfc7eSAndroid Build Coastguard Worker return 0 17*49cdfc7eSAndroid Build Coastguard Worker else 18*49cdfc7eSAndroid Build Coastguard Worker return 1 19*49cdfc7eSAndroid Build Coastguard Worker fi 20*49cdfc7eSAndroid Build Coastguard Worker fi 21*49cdfc7eSAndroid Build Coastguard Worker} 22*49cdfc7eSAndroid Build Coastguard Worker 23*49cdfc7eSAndroid Build Coastguard Workertst_cmd_run() 24*49cdfc7eSAndroid Build Coastguard Worker{ 25*49cdfc7eSAndroid Build Coastguard Worker local cmd="$1" 26*49cdfc7eSAndroid Build Coastguard Worker shift 27*49cdfc7eSAndroid Build Coastguard Worker tst_cmd_available $cmd && eval "$cmd $@" 28*49cdfc7eSAndroid Build Coastguard Worker} 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Workeris_enabled() 31*49cdfc7eSAndroid Build Coastguard Worker{ 32*49cdfc7eSAndroid Build Coastguard Worker [ -f "$1" ] && [ "$(cat $1)" = "Y" -o "$(cat $1)" = "1" ] 33*49cdfc7eSAndroid Build Coastguard Worker} 34*49cdfc7eSAndroid Build Coastguard Worker 35*49cdfc7eSAndroid Build Coastguard Workerecho 'If some fields are empty or look unusual you may have an old version.' 36*49cdfc7eSAndroid Build Coastguard Workerecho 'Compare to the current minimal requirements in Documentation/Changes.' 37*49cdfc7eSAndroid Build Coastguard Worker 38*49cdfc7eSAndroid Build Coastguard Workerecho 39*49cdfc7eSAndroid Build Coastguard Workerecho "`ls /etc/*release 2> /dev/null`" 40*49cdfc7eSAndroid Build Coastguard Workercat /etc/*release 2> /dev/null 41*49cdfc7eSAndroid Build Coastguard Workerif [ $? = 1 ]; then 42*49cdfc7eSAndroid Build Coastguard Worker echo "`ls /usr/lib/*release 2> /dev/null`" 43*49cdfc7eSAndroid Build Coastguard Worker cat /usr/lib/*release 2> /dev/null 44*49cdfc7eSAndroid Build Coastguard Workerfi 45*49cdfc7eSAndroid Build Coastguard Workerif [ $? = 1 ]; then 46*49cdfc7eSAndroid Build Coastguard Worker echo '/etc/issue:' 47*49cdfc7eSAndroid Build Coastguard Worker cat /etc/issue 2> /dev/null 48*49cdfc7eSAndroid Build Coastguard Workerfi 49*49cdfc7eSAndroid Build Coastguard Workerif [ $? = 1 ]; then 50*49cdfc7eSAndroid Build Coastguard Worker echo 'lsb_release -a' 51*49cdfc7eSAndroid Build Coastguard Worker lsb_release -a 2> /dev/null 52*49cdfc7eSAndroid Build Coastguard Workerfi 53*49cdfc7eSAndroid Build Coastguard Worker 54*49cdfc7eSAndroid Build Coastguard Workerecho 55*49cdfc7eSAndroid Build Coastguard Workerecho 'uname:' 56*49cdfc7eSAndroid Build Coastguard Workeruname -a 57*49cdfc7eSAndroid Build Coastguard Worker 58*49cdfc7eSAndroid Build Coastguard Workerecho 59*49cdfc7eSAndroid Build Coastguard Workerecho '/proc/cmdline' 60*49cdfc7eSAndroid Build Coastguard Workercat /proc/cmdline 61*49cdfc7eSAndroid Build Coastguard Worker 62*49cdfc7eSAndroid Build Coastguard Workerecho 63*49cdfc7eSAndroid Build Coastguard Worker 64*49cdfc7eSAndroid Build Coastguard Workerecho "Gnu C " `gcc --version 2>/dev/null | head -n 1` 65*49cdfc7eSAndroid Build Coastguard Workerecho "Clang " `clang --version 2>/dev/null | head -n 1` 66*49cdfc7eSAndroid Build Coastguard Worker 67*49cdfc7eSAndroid Build Coastguard Workermake --version 2>&1 | awk -F, '{print $1}' | awk \ 68*49cdfc7eSAndroid Build Coastguard Worker '/GNU Make/{print "Gnu make ",$NF}' 69*49cdfc7eSAndroid Build Coastguard Worker 70*49cdfc7eSAndroid Build Coastguard Workerld -v 2>&1 | awk -F\) '{print $1}' | awk \ 71*49cdfc7eSAndroid Build Coastguard Worker '/BFD/{print "binutils ",$NF}' 72*49cdfc7eSAndroid Build Coastguard Worker 73*49cdfc7eSAndroid Build Coastguard Workermkswap -V 2>&1 | awk '{print "util-linux ", $NF}' 74*49cdfc7eSAndroid Build Coastguard Worker 75*49cdfc7eSAndroid Build Coastguard Workermount --version 2>&1 | awk -F\- '{print "mount ", $NF}' 76*49cdfc7eSAndroid Build Coastguard Worker 77*49cdfc7eSAndroid Build Coastguard Workerinsmod -V 2>&1 | awk 'NR==1 {print "modutils ",$NF}' 78*49cdfc7eSAndroid Build Coastguard Worker 79*49cdfc7eSAndroid Build Coastguard Workertune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ 80*49cdfc7eSAndroid Build Coastguard Worker'NR==1 {print "e2fsprogs ", $2}' 81*49cdfc7eSAndroid Build Coastguard Worker 82*49cdfc7eSAndroid Build Coastguard Workerreiserfsck 2>&1 | grep reiserfsprogs | awk \ 83*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "reiserfsprogs ", $NF}' 84*49cdfc7eSAndroid Build Coastguard Worker 85*49cdfc7eSAndroid Build Coastguard Workercardmgr -V 2>&1| grep version | awk \ 86*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "pcmcia-cs ", $3}' 87*49cdfc7eSAndroid Build Coastguard Worker 88*49cdfc7eSAndroid Build Coastguard Workerpppd --version 2>&1| grep version | awk \ 89*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "PPP ", $3}' 90*49cdfc7eSAndroid Build Coastguard Worker 91*49cdfc7eSAndroid Build Coastguard Workerisdnctrl 2>&1 | grep version | awk \ 92*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "isdn4k-utils ", $NF}' 93*49cdfc7eSAndroid Build Coastguard Worker 94*49cdfc7eSAndroid Build Coastguard Workerls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \ 95*49cdfc7eSAndroid Build Coastguard Worker-e 's/\.so$//' | awk -F'[.-]' '{print "Linux C Library " \ 96*49cdfc7eSAndroid Build Coastguard Worker$(NF-2)"."$(NF-1)"."$NF}' 97*49cdfc7eSAndroid Build Coastguard Worker 98*49cdfc7eSAndroid Build Coastguard Workerldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 99*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "Dynamic linker (ldd) ", $NF}' 100*49cdfc7eSAndroid Build Coastguard Worker 101*49cdfc7eSAndroid Build Coastguard Workerls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ 102*49cdfc7eSAndroid Build Coastguard Worker '{print "Linux C++ Library " $4"."$5"."$6}' 103*49cdfc7eSAndroid Build Coastguard Worker 104*49cdfc7eSAndroid Build Coastguard Workerps --version 2>&1 | awk 'NR==1{print "Procps ", $NF}' 105*49cdfc7eSAndroid Build Coastguard Worker 106*49cdfc7eSAndroid Build Coastguard Workerifconfig --version 2>&1 | grep tools | awk \ 107*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "Net-tools ", $NF}' 108*49cdfc7eSAndroid Build Coastguard Worker 109*49cdfc7eSAndroid Build Coastguard Workerip -V 2>&1 | awk \ 110*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "iproute2 ", $NF}' 111*49cdfc7eSAndroid Build Coastguard Worker 112*49cdfc7eSAndroid Build Coastguard Workerping -V 2>&1 | awk \ 113*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "iputils ", $NF}' 114*49cdfc7eSAndroid Build Coastguard Worker 115*49cdfc7eSAndroid Build Coastguard Workerethtool --version | grep version 2>&1 | awk \ 116*49cdfc7eSAndroid Build Coastguard Worker'NR==1{print "ethtool ", $NF}' 117*49cdfc7eSAndroid Build Coastguard Worker 118*49cdfc7eSAndroid Build Coastguard Worker# Kbd needs 'loadkeys -h', 119*49cdfc7eSAndroid Build Coastguard Workerloadkeys -h 2>&1 | awk \ 120*49cdfc7eSAndroid Build Coastguard Worker'(NR==1 && ($3 !~ /option/)) {print "Kbd ", $3}' 121*49cdfc7eSAndroid Build Coastguard Worker 122*49cdfc7eSAndroid Build Coastguard Worker# while console-tools needs 'loadkeys -V'. 123*49cdfc7eSAndroid Build Coastguard Workerloadkeys -V 2>&1 | awk \ 124*49cdfc7eSAndroid Build Coastguard Worker'(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools ", $3}' 125*49cdfc7eSAndroid Build Coastguard Worker 126*49cdfc7eSAndroid Build Coastguard Workerexpr --v 2>&1 | awk 'NR==1{print "Sh-utils ", $NF}' 127*49cdfc7eSAndroid Build Coastguard Worker 128*49cdfc7eSAndroid Build Coastguard Workerif [ -e /proc/modules ]; then 129*49cdfc7eSAndroid Build Coastguard Worker X=`cat /proc/modules | sed -e "s/ .*$//"` 130*49cdfc7eSAndroid Build Coastguard Worker echo "Modules Loaded "$X 131*49cdfc7eSAndroid Build Coastguard Workerfi 132*49cdfc7eSAndroid Build Coastguard Worker 133*49cdfc7eSAndroid Build Coastguard Workerecho 134*49cdfc7eSAndroid Build Coastguard Workerecho 'cpuinfo:' 135*49cdfc7eSAndroid Build Coastguard Workertst_cmd_run lscpu || cat /proc/cpuinfo 136*49cdfc7eSAndroid Build Coastguard Worker 137*49cdfc7eSAndroid Build Coastguard Workerecho 138*49cdfc7eSAndroid Build Coastguard Workerecho 'free reports:' 139*49cdfc7eSAndroid Build Coastguard Workerfree 140*49cdfc7eSAndroid Build Coastguard Worker 141*49cdfc7eSAndroid Build Coastguard Workerecho 142*49cdfc7eSAndroid Build Coastguard Workerecho 'memory (/proc/meminfo):' 143*49cdfc7eSAndroid Build Coastguard Workercat /proc/meminfo 144*49cdfc7eSAndroid Build Coastguard Worker 145*49cdfc7eSAndroid Build Coastguard Workerecho 146*49cdfc7eSAndroid Build Coastguard Workerecho 'available filesystems:' 147*49cdfc7eSAndroid Build Coastguard Workerecho $(cut -f2 /proc/filesystems | sort -u) 148*49cdfc7eSAndroid Build Coastguard Worker 149*49cdfc7eSAndroid Build Coastguard Workerecho 150*49cdfc7eSAndroid Build Coastguard Workerecho 'mounted filesystems (/proc/mounts):' 151*49cdfc7eSAndroid Build Coastguard Workercat /proc/mounts 152*49cdfc7eSAndroid Build Coastguard Worker 153*49cdfc7eSAndroid Build Coastguard Workerecho 154*49cdfc7eSAndroid Build Coastguard Workerecho 'mounted filesystems (df):' 155*49cdfc7eSAndroid Build Coastguard Workerif `df -hT >/dev/null 2>/dev/null`; then 156*49cdfc7eSAndroid Build Coastguard Worker df -hT 157*49cdfc7eSAndroid Build Coastguard Workerelse 158*49cdfc7eSAndroid Build Coastguard Worker df 159*49cdfc7eSAndroid Build Coastguard Workerfi 160*49cdfc7eSAndroid Build Coastguard Worker 161*49cdfc7eSAndroid Build Coastguard Worker 162*49cdfc7eSAndroid Build Coastguard Workerecho 163*49cdfc7eSAndroid Build Coastguard Workerif is_enabled /sys/module/apparmor/parameters/enabled; then 164*49cdfc7eSAndroid Build Coastguard Worker echo 'AppArmor enabled' 165*49cdfc7eSAndroid Build Coastguard Worker tst_cmd_run aa-status 166*49cdfc7eSAndroid Build Coastguard Workerelse 167*49cdfc7eSAndroid Build Coastguard Worker echo 'AppArmor disabled' 168*49cdfc7eSAndroid Build Coastguard Workerfi 169*49cdfc7eSAndroid Build Coastguard Worker 170*49cdfc7eSAndroid Build Coastguard Workerecho 171*49cdfc7eSAndroid Build Coastguard Worker 172*49cdfc7eSAndroid Build Coastguard Workerif ! tst_cmd_run sestatus; then 173*49cdfc7eSAndroid Build Coastguard Worker printf 'SELinux mode: ' 174*49cdfc7eSAndroid Build Coastguard Worker tst_cmd_run getenforce || echo 'unknown' 175*49cdfc7eSAndroid Build Coastguard Workerfi 176