Commit cd961000 authored by kyodev's avatar kyodev

tests/debug_gi 1.4.0

parent 0401f292
Pipeline #53279 passed with stages
in 23 seconds
#!/bin/sh
# shellcheck disable=SC2016,SC2034
#~ # shellcheck disable=SC2016,SC2034
# SC2016 Expressions don't expand in single quotes
# SC2034 variable appears unused
version=1.3.0
date="13/04/2018"
version=1.4.0
date="22/05/2018"
script=$( basename "$0" )
output="$script.md"
ligneRapport="Rapport du $(date '+%d/%m/%Y %H:%M %z')$(uname -n)$0 $*$script $version"
......@@ -31,76 +31,111 @@ if ! command -v curl >/dev/null ; then
noexport="yes"
fi
get_cmd(){
if command -v "$1" >/dev/null; then
printf '* %s : ' "$1"
else
echo "* $1 **KO**"
return 1
fi
}
get_version(){
if [ -z "$2" ] && eval "$1" 1>/dev/null 2>&1; then
eval "$1" | head -n1
elif [ "$2" = error ] && eval "$1" 1>/dev/null 2>&1; then
eval "$1" 2>/dev/null | head -n1
elif [ "$2" = stderr ] && eval "$1" 1>/dev/null 2>&1; then
eval "$1" 2>&1 | head -n1
else
echo "version n/a"
fi
}
if [ "$1" = "--noexport" ] || [ "$1" = "-n" ] ; then
noexport="yes"
fi
exec 3>&1 # sauvegarde
exec 1>"$output" # redirection stdout dans fichier
printf "%s\n\n\n" "$ligneRapport"
echo '```'
# système, portabilité
printf "%s\\n\\n\\n" "$ligneRapport"
if command -v awk >/dev/null; then
awk --version 1>/dev/null 2>&1 && awk --version | head -n1 || echo "origin et version inconnue"
else
echo "**awk KO**"
fi
bash --version 1>/dev/null 2>&1 && bash --version | head -n1 || echo "**bash KO**"
free --version 1>/dev/null 2>&1 && free --version || echo "**free KO**"
lsblk --version 1>/dev/null 2>&1 && lsblk --version || echo "**lsblk KO**"
lspci --version 1>/dev/null 2>&1 && lspci --version || echo "**lspci KO**"
if lspci -nnv 1>/dev/null 2>&1 ; then echo "lspci -nnk ok"
echo
echo "système, portabilité" # système, portabilité
echo
get_cmd "acpi" && get_version "acpi --version"
get_cmd "awk" && get_version "awk -V"
get_cmd "mawk" && get_version "mawk -W version" error # error: redirection stderr > null
get_cmd "bash" && get_version "bash --version"
get_cmd "dig" && get_version "dig -v" stderr # stderr: redirection stderr > stdout
get_cmd "drill" && get_version "drill -v" stderr
get_cmd "free" && get_version "free -V"
get_cmd "grep" && get_version "grep -V"
get_cmd "host" && get_version "host -V" stderr
get_cmd "journalctl" && get_version "journalctl --version"
get_cmd "lsblk" && get_version "lsblk -V"
get_cmd "lspci" && get_version "lspci --version"
if lspci -nnv 1>/dev/null 2>&1 ; then
echo "* lspci -nnv : ok"
else
echo "**lspci -nnk KO**"
echo "* lspci -nnk **KO**"
flag_lspci="ko"
fi
journalctl --version 1>/dev/null 2>&1 && echo "journalctl: "$( journalctl --version | head -n1 ) || echo "**journalctl KO**"
[ -e '/etc/shells' ] && echo "/etc/shells existe" || echo "**/etc/shells KO**"
upower --version 1>/dev/null 2>&1 || echo "**upower KO**"
uptime --version 1>/dev/null 2>&1 && uptime --version || echo "**uptime KO**"
xargs --version 1>/dev/null 2>&1 && xargs --version | head -n1 || echo "**xargs KO**"
[ -e '/etc/shells' ] && echo "* /etc/shells : existe" || echo "* /etc/shells **KO**"
get_cmd "sed" && get_version "sed --version"
get_cmd "upower" && get_version "upower -v"
get_cmd "uptime" && get_version "uptime -V"
get_cmd "xargs" && get_version "xargs --version"
# xorg, video
x-window-manager --version 1>/dev/null 2>&1 && echo "x-window-manager: "$( x-window-manager --version | head -n1 ) || echo "**x-window-manager KO**"
xset -version 1>/dev/null 2>&1 && xset -version || echo "**xset KO**"
xdpyinfo -version 1>/dev/null 2>&1 && xdpyinfo -version || echo "**xdpyinfo KO**"
command -v glxinfo >/dev/null && echo "glxinfo ok" || echo "**glxinfo KO**"
xdriinfo nscreens 1>/dev/null 2>&1 || echo "**xdriinfo KO**"
command -v xprop 1>/dev/null 2>&1 || echo "**xprop KO**"
# hardware
command -v acpi >/dev/null && acpi --version | head -n1 || echo "**acpi KO**"
echo
echo "video, xorg" # video, xorg
echo
get_cmd "glxinfo" && echo 'ok'
get_cmd "xdpyinfo" && get_version "xdpyinfo -version"
get_cmd "xdriinfo" && get_version "xdriinfo nscreens" && echo
get_cmd "xprop" && echo 'ok'
get_cmd "xset" && get_version "xset -version"
get_cmd "x-window-manager" && get_version "x-window-manager -V"
printf "%s\n\n" '```'
echo
echo "---"
echo
###############################################################################################################
# cpuinfo
echo '## cpuinfo'
printf "%s\n" '```'
awk '{if ( $0 ~ /^$/ ) {exit} else {print}}' /proc/cpuinfo 2>/dev/null || echo "/proc/cpuinfo inexistant"
printf "%s\n\n" '```'
printf "\\n%s\\n" '```'
if [ -e "/proc/cpuinfo" ]; then
if command -v awk >/dev/null; then
awk '{if ( $0 ~ /^$/ ) {exit} else {print}}' /proc/cpuinfo 2>/dev/null
else
echo "/proc/cpuinfo existe, mais pas de awk"
fi
else
echo "/proc/cpuinfo inexistant"
fi
printf "%s\\n\\n" '```'
# upower
if upower --version 1>/dev/null 2>&1 ; then
echo "## upower"
printf "%s\n" '```'
printf "\\n%s\\n" '```'
upower --enumerate
upower --version || echo "upower KO"
printf "%s\n\n" '```'
printf "%s\\n\\n" '```'
fi
# xdriinfo Direct Rendering Interface?
if xdriinfo nscreens 1>/dev/null 2>&1 ; then
echo "## $( xdriinfo -version 2>/dev/null )"
echo '```'
printf "\\n%s\\n" '```'
echo "xdriinfo: $( xdriinfo 2>/dev/null )"
echo "xdriinfo nscreens: $( xdriinfo nscreens 2>/dev/null )"
echo "xdriinfo driver 0: $( xdriinfo driver 0 2>/dev/null )"
echo "xdriinfo options $(xdriinfo options 0 2>/dev/null): $( xdriinfo options "$(xdriinfo options 0 2>/dev/null)" 2>/dev/null )"
printf "%s\n\n" '```'
printf "%s\\n\\n" '```'
fi
# xprop
......@@ -112,50 +147,45 @@ if command -v xprop >/dev/null 2>&1; then
# wm annexe
xprop="$( xprop -root -notype -display "$DISPLAY" 2>/dev/null )"
echo "## xprop"
printf "%s\n" '```'
printf "\\n%s\\n" '```'
echo "### xprop -id :"
echo "$wm_brut"
echo
echo "### xprop -root -notype -display $DISPLAY :"
echo "$xprop"
printf "%s\n\n" '```'
printf "%s\\n\\n" '```'
fi
# /usr/share/xsessions
echo "## ls -l /usr/share/xsessions "
echo '```'
printf "\\n%s\\n" '```'
ls -l /usr/share/xsessions 2>/dev/null
printf "%s\n\n" '```'
# général, wm annexe
echo "## ps -ef"
echo '```'
ps -ef
printf "%s\n\n" '```'
# panel
printf "%s\\n\\n" '```'
# général
echo "## ps -e"
echo '```'
ps -A
printf "%s\n\n" '```'
printf "\\n%s\\n" '```'
ps -e
printf "%s\\n\\n" '```'
# env
echo "## env"
echo '```'
printf "\\n%s\\n" '```'
env | sort
printf "%s\n\n" '```'
printf "%s\\n\\n" '```'
if [ -z "$flag_lspci" ]; then
# lspci
echo "## lspci -nnk"
echo '```'
printf "\\n%s\\n" '```'
lspci -nnk
printf "%s\n\n" '```'
printf "%s\\n\\n" '```'
fi
exec 1>&3 # restauration
exec 3>&- # fermeture FD
if [ -z "$noexport" ]; then
printf "%s \n\n" "url du rapport:"
printf "%s \\n\\n" "url du rapport:"
curl -s --upload-file "$output" "https://transfer.sh/$output"
echo
fi
......@@ -169,4 +199,4 @@ exit 0
wget -nv -O debug_gi https://framagit.org/kyodev/kyopages/raw/master/scripts/tests/debug_gi
chmod +x debug_gi && ./debug_gi
curl -o debug_gi https://framagit.org/kyodev/kyopages/raw/master/scripts/tests/debug_gi
curl -O https://framagit.org/kyodev/kyopages/raw/master/scripts/tests/debug_gi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment