mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.42.0
This commit is contained in:
parent
6993802ecc
commit
45c22973ce
222
scripts/getInfo
222
scripts/getInfo
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version=2.41.5
|
version=2.42.0
|
||||||
date="21/11/2017"
|
date="21/11/2017"
|
||||||
projet="simpledeb"
|
projet="simpledeb"
|
||||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||||
|
@ -357,13 +357,13 @@ f_display(){ # 20/11/2017
|
||||||
# $1 variable à afficher en alerte/info, [$2 alert|info] type de message, alert par défaut
|
# $1 variable à afficher en alerte/info, [$2 alert|info] type de message, alert par défaut
|
||||||
# passage en paramètre variable et pas $variable
|
# passage en paramètre variable et pas $variable
|
||||||
# un test si variable $1 est vide ou non est fait
|
# un test si variable $1 est vide ou non est fait
|
||||||
f_dspl_alert(){ # 19/11/2017
|
f_dspl_alert(){ # 21/11/2017
|
||||||
[ "${!1}" ] || return 0 # test si contenu dans $1
|
[ "${!1}" ] || return 0 # test si contenu dans $1
|
||||||
local display type
|
local display type
|
||||||
# flush, avant fonction, de $text parent
|
# flush, avant fonction, de $text parent
|
||||||
[ "$text" ] && echo -en "$text\n" >> "$fileOutput"
|
[ "$text" ] && echo -en "$text\n" >> "$fileOutput"
|
||||||
unset text
|
unset text
|
||||||
# coeur fonction
|
|
||||||
[[ "$2" =~ info ]] && type="info"
|
[[ "$2" =~ info ]] && type="info"
|
||||||
[[ "$2" =~ alert ]] && type="alert"
|
[[ "$2" =~ alert ]] && type="alert"
|
||||||
[ "$2" ] || type="alert" # alert par défaut
|
[ "$2" ] || type="alert" # alert par défaut
|
||||||
|
@ -1055,10 +1055,16 @@ fi_graph(){ # 21/11/2017
|
||||||
openGl=${openGl// string:/:} # suppression chaîne ' string'
|
openGl=${openGl// string:/:} # suppression chaîne ' string'
|
||||||
openGl=${openGl% } # suppression espace final éventuel
|
openGl=${openGl% } # suppression espace final éventuel
|
||||||
fi
|
fi
|
||||||
# xrandr: résolutionS & providers & preferred/current
|
# xrandr: résolutionS & providers & preferred/current
|
||||||
[ $( f__which xrandr ) ] && resolutions="$( xrandr --query | grep -A11 'Screen [0-9]' )"
|
if [[ "$wayland" && "$EUID" -eq 0 ]]; then # évite erreur $DISPLAY en root wayland
|
||||||
[ $( f__which xrandr ) ] && providers="$( xrandr --listproviders )" # DRI: ok, sort 2 fournisseurs
|
resolutions="n/a en root sous wayland"
|
||||||
[ $( f__which xrandr ) ] && current_preferred="$( xrandr --verbose | grep -EA2 'current|preferred' )"
|
providers="n/a en root sous wayland"
|
||||||
|
current_preferred="n/a en root sous wayland"
|
||||||
|
else
|
||||||
|
[ $( f__which xrandr ) ] && resolutions="$( xrandr --query | grep -A11 'Screen [0-9]' )"
|
||||||
|
[ $( f__which xrandr ) ] && providers="$( xrandr --listproviders )" # DRI: ok, sort 2 fournisseurs
|
||||||
|
[ $( f__which xrandr ) ] && current_preferred="$( xrandr --verbose | grep -EA2 'current|preferred' )"
|
||||||
|
fi
|
||||||
# modules
|
# modules
|
||||||
modules="$(lsmod | grep -Ei 'amdgpu|ati|i915|nouveau|nvidia|radeon|video|gma')"
|
modules="$(lsmod | grep -Ei 'amdgpu|ati|i915|nouveau|nvidia|radeon|video|gma')"
|
||||||
cmt_modules="modules recherchés: amdgpu, ati, i915, nouveau, nvidia, radeon, video, gma"
|
cmt_modules="modules recherchés: amdgpu, ati, i915, nouveau, nvidia, radeon, video, gma"
|
||||||
|
@ -1831,12 +1837,12 @@ fi_ssid(){ # 09/11/2017
|
||||||
unset text
|
unset text
|
||||||
}
|
}
|
||||||
|
|
||||||
fi_system_analyse(){ # 20/11/2017
|
fi_system_analyse(){ #v 21/11/2017
|
||||||
[ $( f__which systemd ) ] || return 0 # pas systemd
|
[ $( f__which systemd ) ] || return 0 # pas systemd
|
||||||
local bootTime cmd_bootTime cmt_bootTime pluriel text
|
local bootTime cmd_bootTime cmt_bootTime pluriel text
|
||||||
local srvcFail cmd_srvcFail cmt_srvcFail qte_srvcFail isrvc srvcFail_list
|
local srvcFail cmd_srvcFail cmt_srvcFail qte_srvcFail isrvc srvcFail_list
|
||||||
local bootBlame cmd_bootBlame cmt_bootBlame bootCritic cmd_bootCritic cmt_bootCritic
|
local bootBlame cmd_bootBlame cmt_bootBlame bootCritic cmd_bootCritic cmt_bootCritic
|
||||||
local bootGraph cmd_bootGraph cmt_bootGraph
|
local bootGraph cmd_bootGraph cmt_bootGraph file="/tmp/getInfo-graph-$RANDOM.svg"
|
||||||
local alert_srvcFail
|
local alert_srvcFail
|
||||||
# durée du précédent boot
|
# durée du précédent boot
|
||||||
bootTime=$( systemd-analyze time )
|
bootTime=$( systemd-analyze time )
|
||||||
|
@ -1875,16 +1881,19 @@ fi_system_analyse(){ # 20/11/2017
|
||||||
bootCritic=${bootCritic/The time the unit takes to start is printed after the \"+\" character./ +: temps que l\'unité prend pour démarrer}
|
bootCritic=${bootCritic/The time the unit takes to start is printed after the \"+\" character./ +: temps que l\'unité prend pour démarrer}
|
||||||
cmd_bootCritic="systemd-analyze critical-chain"
|
cmd_bootCritic="systemd-analyze critical-chain"
|
||||||
cmt_bootCritic="services critiques ralentisseurs"
|
cmt_bootCritic="services critiques ralentisseurs"
|
||||||
# génération graphique
|
# génération graphique
|
||||||
systemd-analyze plot > "/tmp/getInfo-graph.svg" 2>/dev/null
|
if [[ "$wayland" && "$EUID" -eq 0 ]]; then # évite erreur $DISPLAY en root wayland
|
||||||
bootGraph="en console: \`xdg-open /tmp/getInfo-graph.svg\` \n"
|
bootGraph="n/a en root sous wayland"
|
||||||
bootGraph+="* dans un navigateur: copier/coller ce lien dans la barre d'adresses "
|
else
|
||||||
bootGraph+="file:///tmp/getInfo-graph.svg \n"
|
systemd-analyze plot > "$file" 2>/dev/null
|
||||||
# un lien local ne s'ouvrira pas automatiquement :( : http://kb.mozillazine.org/Links_to_local_pages_do_not_work
|
chown $user_: "$file"
|
||||||
|
bootGraph="en console: **xdg-open $file** \n"
|
||||||
|
bootGraph+="* dans un navigateur: copier/coller ce lien dans la barre d'adresses "
|
||||||
|
bootGraph+="file:///$file \n"
|
||||||
|
fi
|
||||||
|
# un lien local ne s'ouvrira pas automatiquement :( : http://kb.mozillazine.org/Links_to_local_pages_do_not_work
|
||||||
cmd_bootGraph="systemd-analyze plot > graph.svg ; xdg-open graph.svg"
|
cmd_bootGraph="systemd-analyze plot > graph.svg ; xdg-open graph.svg"
|
||||||
cmt_bootGraph="graph durées et ordre de chargement des services"
|
cmt_bootGraph="graph durées et ordre de chargement des services"
|
||||||
# workaround, erreur buster en root, fichier non crée
|
|
||||||
[ -e "/tmp/getInfo-graph.svg" ] || unset bootGraph
|
|
||||||
###
|
###
|
||||||
text="## analyse boot systemd \n\n"
|
text="## analyse boot systemd \n\n"
|
||||||
[ "$srvcFail" ] || text+="* pas de service en erreur \n\n"
|
[ "$srvcFail" ] || text+="* pas de service en erreur \n\n"
|
||||||
|
@ -1898,7 +1907,7 @@ fi_system_analyse(){ # 20/11/2017
|
||||||
unset text
|
unset text
|
||||||
}
|
}
|
||||||
|
|
||||||
fi_systeme(){ # 19/11/2017
|
fi_systeme(){ # 21/11/2017
|
||||||
local mbr uname bootImage initDaemon serverX shells lastboot uptime charge pluriel text
|
local mbr uname bootImage initDaemon serverX shells lastboot uptime charge pluriel text
|
||||||
local alimentation alim_total ish ifs_origin ligne date_install microcode
|
local alimentation alim_total ish ifs_origin ligne date_install microcode
|
||||||
local alert_SLiM alert_microcode
|
local alert_SLiM alert_microcode
|
||||||
|
@ -1910,10 +1919,9 @@ fi_systeme(){ # 19/11/2017
|
||||||
[ "$initDaemon" == "systemd" ] && initDaemon=$( systemd --version )
|
[ "$initDaemon" == "systemd" ] && initDaemon=$( systemd --version )
|
||||||
initDaemon=${initDaemon%%[[:space:]]+*}
|
initDaemon=${initDaemon%%[[:space:]]+*}
|
||||||
initDaemon=${initDaemon/systemd/systemd version}
|
initDaemon=${initDaemon/systemd/systemd version}
|
||||||
[ "$ENV_SSH" ] && serverX="n/a (ssh)" || serverX="$XDG_SESSION_TYPE"
|
[ "$ENV_SSH" ] && serverX="n/a (ssh)" || serverX="$XDG_SESSION_TYPE" # normalement retourne wayland
|
||||||
if [ -z "$serverX" ]; then
|
[ "$wayland" ] && serverX="$wayland"
|
||||||
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && serverX="wayland" || serverX="indéterminé"
|
[ "$serverX" ] || serverX="n/a"
|
||||||
fi
|
|
||||||
for ish in $(f_grep_file "/etc/shells" "nofile"); do
|
for ish in $(f_grep_file "/etc/shells" "nofile"); do
|
||||||
shells+=${ish##*/}" " # conservation dernier "champs", ifs '/'
|
shells+=${ish##*/}" " # conservation dernier "champs", ifs '/'
|
||||||
done
|
done
|
||||||
|
@ -2155,7 +2163,7 @@ figet_batt(){ #v2 11/11/2017
|
||||||
}
|
}
|
||||||
|
|
||||||
# assigne $fg_cpu (3 lignes description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=amd|intel
|
# assigne $fg_cpu (3 lignes description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=amd|intel
|
||||||
figet_cpu(){ #v2 05/11/2017
|
figet_cpu(){ #v2 21/11/2017
|
||||||
local cpuinfo speedNom speedMax speedMin speedCpu cpu1 cpu2 cpu3
|
local cpuinfo speedNom speedMax speedMin speedCpu cpu1 cpu2 cpu3
|
||||||
cpuinfo="$(cat /proc/cpuinfo)"
|
cpuinfo="$(cat /proc/cpuinfo)"
|
||||||
# speed
|
# speed
|
||||||
|
@ -2205,7 +2213,7 @@ figet_cpu(){ #v2 05/11/2017
|
||||||
# arch processeur
|
# arch processeur
|
||||||
[ $(grep -cm1 'flags.* lm ' /proc/cpuinfo) -ge 1 ] && fg_cpu_arch="64bits" || fg_cpu_arch="32bits"
|
[ $(grep -cm1 'flags.* lm ' /proc/cpuinfo) -ge 1 ] && fg_cpu_arch="64bits" || fg_cpu_arch="32bits"
|
||||||
# traitement µarchitecture
|
# traitement µarchitecture
|
||||||
figet_cpu_uarch
|
[ "$fg_uarch" ] || figet_cpu_uarch
|
||||||
[[ ${fg_cpu,,} =~ amd ]] && fg_vendor="amd"
|
[[ ${fg_cpu,,} =~ amd ]] && fg_vendor="amd"
|
||||||
[[ ${fg_cpu,,} =~ intel ]] && fg_vendor="intel"
|
[[ ${fg_cpu,,} =~ intel ]] && fg_vendor="intel"
|
||||||
}
|
}
|
||||||
|
@ -2338,36 +2346,38 @@ figet_cpu_uarch(){ # 05/11/2017
|
||||||
[ "$fg_uarch" ] && fg_uarch+=" {0x$family|0x$model}"
|
[ "$fg_uarch" ] && fg_uarch+=" {0x$family|0x$model}"
|
||||||
}
|
}
|
||||||
|
|
||||||
figet_de(){ # thanks neofetch, assigne $fg_de #20/11/2017
|
# assigne $fg_de
|
||||||
fg_de="n/a (ssh)"
|
figet_de(){ #v 21/11/2017 # thanks neofetch
|
||||||
[ "$ENV_SSH" ] && return 0 || fg_de="n/a"
|
|
||||||
[ $( f__which xprop ) ] || return 0
|
|
||||||
local de="n/a"
|
local de="n/a"
|
||||||
|
fg_de="n/a"
|
||||||
|
[ "$ENV_SSH" ] && fg_de+=": ssh"
|
||||||
|
[[ "$fg_de" =~ : ]] && return 0 # retourne n/a: xprop ou n/a: ssh
|
||||||
|
|
||||||
de="$XDG_CURRENT_DESKTOP"
|
de="$XDG_CURRENT_DESKTOP"
|
||||||
de="${de/'X-'}"
|
[ "$de" ] || "$DESKTOP_SESSION"
|
||||||
de="${de/Budgie:GNOME/Budgie}"
|
de=${DESKTOP_SESSION##*/} # suppression plus grande chaine au début jusqu'à /, pour $DESKTOP_SESSION
|
||||||
# Fallback to using xprop.
|
de=${de/X-} # supression de X-
|
||||||
if [[ -n "$DISPLAY" && "$de" == "n/a" ]]; then
|
de=${de/Budgie:GNOME/Budgie} # remplacement Budgie:GNOME par Budgie
|
||||||
de="$(xprop -root | gawk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5|TDE_FULL_SESSION/')" #ajout TDE_FULL_SESSION, oubli?à tester
|
# fallback to using xprop
|
||||||
|
if [[ "$wayland" && "$EUID" -eq 0 && "$de" == "n/a" ]]; then
|
||||||
|
fg_de+=": wayland root"
|
||||||
|
return 0
|
||||||
|
elif [[ "$de" == "n/a" ]]; then
|
||||||
|
de=$( xprop -root | gawk 'IGNORECASE = 1;/KDE_SESSION_VERSION|^_MUFFIN|xfce/' )
|
||||||
fi
|
fi
|
||||||
# Format strings
|
# Format strings
|
||||||
case "$de" in
|
if [[ "${de,,}" =~ kde_session_version ]]; then
|
||||||
"KDE_SESSION_VERSION"* )
|
de="KDE"${de/* = }
|
||||||
de="KDE${de/* = }"
|
elif [[ "${de,,}" =~ tde_full_session ]]; then
|
||||||
;;
|
de="Trinity" # fork kde 3.5
|
||||||
*"TDE_FULL_SESSION"* )
|
elif [[ "${de,,}" =~ muffin || "$de" =~ Cinnamon ]]; then
|
||||||
de="Trinity"
|
de=$( cinnamon --version )
|
||||||
;;
|
de=${de:-cinnamon}
|
||||||
*"MUFFIN"* | "Cinnamon" )
|
elif [[ "${de,,}" =~ xfce ]]; then
|
||||||
de="$(cinnamon --version)"
|
de="xfce" # suppression xfce4 ou xfce5 (la version ne sort pas dans xprop ou $XDG_
|
||||||
de="${de:-Cinnamon}"
|
fi
|
||||||
;;
|
fg_de=${de,,} # minuscule
|
||||||
*"xfce"*)
|
fg_de=${fg_de^} # car 1 en majuscule
|
||||||
de="xfce" # suppression xfce4 ou xfce5 (la version ne sort pas dans xprop ou $XDG_
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fg_de="${de,,}" # minuscule
|
|
||||||
fg_de="${fg_de^}" # car 1 en majuscule
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $fg_nb_disk : nb disk fixe & amovible, $fg_disk_table : tableau sommaire, fg_disk_serial
|
# $fg_nb_disk : nb disk fixe & amovible, $fg_disk_table : tableau sommaire, fg_disk_serial
|
||||||
|
@ -2861,12 +2871,17 @@ figet_mod_net(){ # thanks wireless-info
|
||||||
}
|
}
|
||||||
|
|
||||||
# assigne $fg_nb_screen, $fg_resolution. return fg_resolution=n/a[ (ssh)] & fg_nb_screen=n/a ou valeurs
|
# assigne $fg_nb_screen, $fg_resolution. return fg_resolution=n/a[ (ssh)] & fg_nb_screen=n/a ou valeurs
|
||||||
figet_screen(){ #v2 20/11/2017
|
figet_screen(){ #v2 21/11/2017
|
||||||
fg_nb_screen="n/a"
|
fg_nb_screen="n/a"
|
||||||
fg_resolution="n/a"
|
fg_resolution="n/a"
|
||||||
[ "$ENV_SSH" ] && fg_resolution+=" (ssh)"
|
[ "$ENV_SSH" ] && fg_nb_screen+=": ssh"
|
||||||
[ "$ENV_SSH" ] && return 0
|
[ "$ENV_SSH" ] && fg_resolution+=": ssh"
|
||||||
# xrandr & et xdpyinfo ne retourne pas de nombre écrans correct (multiplex? hybrid?)
|
[ $( f__which xrandr ) ] || fg_resolution+=": xrandr absent"
|
||||||
|
[[ "$wayland" && "$EUID" -eq 0 ]] && fg_nb_screen+=": wayland root"
|
||||||
|
[[ "$wayland" && "$EUID" -eq 0 ]] && fg_resolution+=": wayland root"
|
||||||
|
[[ "$fg_resolution" =~ : ]] && return 0 # retourne n/a: xprop ou n/a: ssh
|
||||||
|
##
|
||||||
|
# xrandr & et xdpyinfo ne retourne pas de nombre écrans correct (multiplex? hybrid?)
|
||||||
if [ $( f__which xrandr ) ]; then
|
if [ $( f__which xrandr ) ]; then
|
||||||
fg_resolution=$( gawk '/[0-9]\*/ {gsub(/\*\+/,"",$2); printf "%s pixels (%dHz), ", $1, $2}' <<< $( xrandr --query ) )
|
fg_resolution=$( gawk '/[0-9]\*/ {gsub(/\*\+/,"",$2); printf "%s pixels (%dHz), ", $1, $2}' <<< $( xrandr --query ) )
|
||||||
elif [ $( f__which xdpyinfo ) ]; then
|
elif [ $( f__which xdpyinfo ) ]; then
|
||||||
|
@ -2999,23 +3014,45 @@ figet_test_hw(){ # 20/11/2017
|
||||||
f_display "fg_hw" "var" "figet_hw"
|
f_display "fg_hw" "var" "figet_hw"
|
||||||
}
|
}
|
||||||
|
|
||||||
figet_wm(){ # thanks neofetch, assigne $fg_wm # 30/10/2017
|
# assigne $fg_wm
|
||||||
fg_wm="n/a (ssh)"
|
figet_wm(){ #v 21/11/2017 thanks neofetch
|
||||||
[ "$ENV_SSH" ] && return 0 || fg_wm="n/a"
|
local id wm_brut compositor
|
||||||
[ $( f__which xprop ) ] || return 0
|
fg_wm="n/a"
|
||||||
local id wm
|
[ "$ENV_SSH" ] && fg_wm+=": ssh"
|
||||||
if [ -n "$DISPLAY" ]; then
|
[ $( f__which xprop ) ] || fg_wm+=": xprop absent"
|
||||||
id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK | cut -d' ' -f5)"
|
[[ "$wayland" && "$EUID" -eq 0 ]] && fg_wm+=": wayland root"
|
||||||
wm="$(xprop -id "$id" -notype -f _NET_WM_NAME 8t) "
|
[[ "$fg_wm" =~ : ]] && return 0 # retourne n/a: xprop ou n/a: ssh
|
||||||
wm="${wm/*_NET_WM_NAME = }"
|
##
|
||||||
wm="${wm/\"}"
|
id=$( xprop -root -notype _NET_SUPPORTING_WM_CHECK )
|
||||||
wm="${wm/\"*}"
|
id=${id##* } # suppression plus grande chaîne au début jusqu"à ' '
|
||||||
# Fallback for Wayland wms
|
wm_brut=$( xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t )
|
||||||
[[ "$wm" == "xwlc" ]] && wm="$(ps -e | grep -m 1 -o -F -e "sway" -e "orbment" -e "velox" -e "orbital")"
|
[ "$debug" ] && echo "$wm_brut"
|
||||||
else
|
fg_wm=${wm_brut/*_NET_WM_NAME = } # suppression jusqu'à 'NAME = '
|
||||||
wm="indéterminé"
|
fg_wm=${fg_wm/\"} # suppression premier"
|
||||||
|
fg_wm=${fg_wm/\"*} # suppression 2e " avec éventuels caractères suivants
|
||||||
|
# Window Maker does not set _NET_WM_NAME
|
||||||
|
[[ "$fg_wm" =~ "WINDOWMAKER" ]] && fg_wm="wmaker"
|
||||||
|
# Fallback for Wayland wms (sway)
|
||||||
|
[[ "$fg_wm" == "xwlc" ]] && fg_wm=$( ps -e | grep -m1 -Eo 'sway|orbment|velox|orbital' )
|
||||||
|
if [[ "$wm_brut" =~ MUTTER_VERSION ]]; then
|
||||||
|
compositor=${wm_brut/*_MUTTER_VERSION = } # suppression jusqu'à ...
|
||||||
|
compositor=${compositor/\"} # suppression premier"
|
||||||
|
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
|
||||||
|
compositor="(Mutter version $compositor)"
|
||||||
fi
|
fi
|
||||||
fg_wm="$wm"
|
if [[ "$wm_brut" =~ MUFFIN_VERSION ]]; then # en aveugle, jamais vu d'essai
|
||||||
|
compositor=${wm_brut/*MUFFIN_VERSION = } # suppression jusqu'à ...
|
||||||
|
compositor=${compositor/\"} # suppression premier"
|
||||||
|
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
|
||||||
|
compositor="(Muffin version $compositor)"
|
||||||
|
fi
|
||||||
|
if [[ "$wm_brut" =~ MARCO_VERSION ]]; then
|
||||||
|
compositor=${wm_brut/*_MARCO_VERSION = } # suppression jusqu'à ...
|
||||||
|
compositor=${compositor/\"} # suppression premier"
|
||||||
|
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
|
||||||
|
compositor="(Marco version $compositor)"
|
||||||
|
fi
|
||||||
|
[ "$compositor" ] && fg_wm="$fg_wm $compositor"
|
||||||
}
|
}
|
||||||
|
|
||||||
# aiguillage export paste
|
# aiguillage export paste
|
||||||
|
@ -3210,12 +3247,7 @@ prg_1(){ # début
|
||||||
echo -e "> $script sur *$(uname -n)* \n" > "$fileOutput"
|
echo -e "> $script sur *$(uname -n)* \n" > "$fileOutput"
|
||||||
echo -e "$ligneRapport \n\n" >> "$fileOutput"
|
echo -e "$ligneRapport \n\n" >> "$fileOutput"
|
||||||
}
|
}
|
||||||
prg_2(){ # traitements principaux 20/11/2017
|
prg_2(){ # traitements principaux 21/11/2017
|
||||||
# essai détection erreur No protocol specified, Can't open display :0 (root Fedora)
|
|
||||||
if [ -z "$DISPLAY" ]; then
|
|
||||||
f__info "des erreurs$YELLOW Can't open display$BLUE peut indiquer une nouvelle fonctionnalité Wayland" \
|
|
||||||
"lancer le script en utilisateur pour avoir toutes les informations"
|
|
||||||
fi
|
|
||||||
if [[ "$1" == all || "$1" =~ s ]]; then #systeme, matériel -cs
|
if [[ "$1" == all || "$1" =~ s ]]; then #systeme, matériel -cs
|
||||||
echo -e "# ▷ Système \n\n" >> "$fileOutput"
|
echo -e "# ▷ Système \n\n" >> "$fileOutput"
|
||||||
for i in fi_systeme fi_cpu fi_mem fi_hw fi_batt fi_graph fi_disk fi_usb ; do
|
for i in fi_systeme fi_cpu fi_mem fi_hw fi_batt fi_graph fi_disk fi_usb ; do
|
||||||
|
@ -3284,13 +3316,20 @@ function display_menu {
|
||||||
reply="$(sed 's/-call/all/' <<< $reply)"
|
reply="$(sed 's/-call/all/' <<< $reply)"
|
||||||
exec $0 "$reply"
|
exec $0 "$reply"
|
||||||
}
|
}
|
||||||
prg_alert_init(){ # 11/10/2017
|
prg_init(){ # 21/11/2017
|
||||||
bashVersion=($(grep -o 'version 4' <<< $(bash --version)))
|
PATH='/usr/sbin:/usr/bin:/sbin:/bin'
|
||||||
|
TERM=xterm
|
||||||
|
IFS=$' \t\n'
|
||||||
|
export PATH TERM IFS
|
||||||
|
# aucune erreur visible, prévoir option --debug
|
||||||
|
# exec 2>/dev/null
|
||||||
|
# exec 2>"$script.log" # à tester
|
||||||
|
# test bash v4
|
||||||
|
bashVersion=( $( grep -o 'version 4' <<< $( bash --version ) ) )
|
||||||
[ ${bashVersion[1]} -ge 4 ] || f__error "bash v4 requis" \
|
[ ${bashVersion[1]} -ge 4 ] || f__error "bash v4 requis" \
|
||||||
"version installée: $(sed -n '1p' <<< $(bash --version))"
|
"version installée: $( grep -m1 'version' <<< $(bash --version) )"
|
||||||
|
# test /proc
|
||||||
[ -e /proc/cpuinfo ] || f__error "/proc/cpuinfo non trouvé" "/proc ne doit pas être monté"
|
[ -e /proc/cpuinfo ] || f__error "/proc/cpuinfo non trouvé" "/proc ne doit pas être monté"
|
||||||
|
|
||||||
# test OS
|
# test OS
|
||||||
OS=$(uname -s)
|
OS=$(uname -s)
|
||||||
[[ ${OS,,} =~ linux || ${OS,,} =~ gnu ]] && OS="linux"
|
[[ ${OS,,} =~ linux || ${OS,,} =~ gnu ]] && OS="linux"
|
||||||
|
@ -3299,7 +3338,17 @@ prg_alert_init(){ # 11/10/2017
|
||||||
[ "$OS" == "bsd" ] && f__info "ce script pour Linux n'est pas prévu de fonctionner sur BSD..."
|
[ "$OS" == "bsd" ] && f__info "ce script pour Linux n'est pas prévu de fonctionner sur BSD..."
|
||||||
[ "$OS" == "windows" ] && f__info "ce script pour Linux n'est pas prévu de fonctionner sous windows..."
|
[ "$OS" == "windows" ] && f__info "ce script pour Linux n'est pas prévu de fonctionner sous windows..."
|
||||||
[ "$OS" != "linux" ] && f__error "Linux requis"
|
[ "$OS" != "linux" ] && f__error "Linux requis"
|
||||||
|
# recherche wayland
|
||||||
|
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && wayland="wayland"
|
||||||
|
# essai détection erreur No protocol specified, Can't open display :0 (root Fedora)
|
||||||
|
if [[ "$wayland" && "$EUID" -eq 0 ]]; then
|
||||||
|
f__info "Wayland ne permet pas de lancer des applications graphiques en Root" \
|
||||||
|
"seul l'utilisateur ayant démarré le serveur X peut permettre des connexions à celui-ci" \
|
||||||
|
"le plus simple est de redémarrer le script en utilisateur pour déterminer certaines propriétés graphiques" \
|
||||||
|
"ou essayer xhost si:localuser:root pour autoriser, xhost -si:localuser:root pour enlever cette autorisation"
|
||||||
|
fi
|
||||||
|
# test SSH
|
||||||
|
[[ "$SSH_CLIENT" || "$SSH_CLIENT" || "$SSH_CLIENT" ]] && ENV_SSH="ssh"
|
||||||
# détermination user derrière root
|
# détermination user derrière root
|
||||||
f__user
|
f__user
|
||||||
retourFUser="$?"
|
retourFUser="$?"
|
||||||
|
@ -3312,16 +3361,12 @@ prg_alert_init(){ # 11/10/2017
|
||||||
}
|
}
|
||||||
|
|
||||||
######## début script / initialisation
|
######## début script / initialisation
|
||||||
PATH='/usr/sbin:/usr/bin:/sbin:/bin'; TERM=xterm ; IFS=$' \t\n'
|
|
||||||
export PATH TERM IFS
|
|
||||||
[[ "$SSH_CLIENT" || "$SSH_CLIENT" || "$SSH_CLIENT" ]] && ENV_SSH="ssh"
|
|
||||||
|
|
||||||
# logo et définition couleurs
|
# logo et définition couleurs
|
||||||
f__affichage
|
f__affichage
|
||||||
|
|
||||||
# tests au démarrage
|
# tests au démarrage
|
||||||
prg_alert_init
|
prg_init
|
||||||
|
|
||||||
# requis pour fonctionnement programme
|
# requis pour fonctionnement programme
|
||||||
f__requis "gawk wget ip>iproute2 lspci>pciutils wc>coreutils" || exit 1
|
f__requis "gawk wget ip>iproute2 lspci>pciutils wc>coreutils" || exit 1
|
||||||
|
|
||||||
|
@ -3372,7 +3417,8 @@ for j in $options; do
|
||||||
case $j in
|
case $j in
|
||||||
-t | --test )
|
-t | --test )
|
||||||
prg_1 "$*"
|
prg_1 "$*"
|
||||||
fi_log_xorg
|
echo -n "."
|
||||||
|
fi_systeme
|
||||||
exit ;; # test
|
exit ;; # test
|
||||||
-c* | all )
|
-c* | all )
|
||||||
[ "$j" == "-c" ] && exec $0 "menu"
|
[ "$j" == "-c" ] && exec $0 "menu"
|
||||||
|
|
|
@ -3,9 +3,13 @@
|
||||||
* f__wcv, f_display_grep, f_dspl_md, f__wget_test, fscript_get_version, fscript_update
|
* f__wcv, f_display_grep, f_dspl_md, f__wget_test, fscript_get_version, fscript_update
|
||||||
* ! f__requis, fscript_install, f__scandir
|
* ! f__requis, fscript_install, f__scandir
|
||||||
|
|
||||||
## 2.41.5 21/11/2017
|
## 2.42.0 21/11/2017
|
||||||
|
|
||||||
|
* révision: wayland, wayland/root, évolution wayland si plus de xprop, xrandr, xdpyinfo...
|
||||||
|
* révision: fi_system, figet_de, fi_graph, figet_screen, fi_system_analyse prise en compte wayland
|
||||||
|
* révision: figet_wm, + compositor si connu
|
||||||
* révision: fi_log_xorg, + emplacement log sous gdm3 X11 (nouveau sous buster?), cmd et info adaptés
|
* révision: fi_log_xorg, + emplacement log sous gdm3 X11 (nouveau sous buster?), cmd et info adaptés
|
||||||
|
* fix, fi_system_analyse si graph généré par root
|
||||||
|
|
||||||
## 2.41.3 20/11/2017
|
## 2.41.3 20/11/2017
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue