mirror of https://framagit.org/kyodev/kyopages.git
getIngo 2.5.0
This commit is contained in:
parent
f6d99cf7fb
commit
3b9468ee95
137
scripts/getInfo
137
scripts/getInfo
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=2.4.2
|
||||
version=2.5.0
|
||||
date="13/10/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
|
@ -155,6 +155,35 @@ f__requis(){ # 22/09/2017
|
|||
fi
|
||||
}
|
||||
|
||||
# $1=rep à scanner [$2=profondeur max|4 défaut] [$3=profondeur encours|0 défaut]
|
||||
f__scandir(){ # 13/10/2017
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "manque répertoire à scanner"
|
||||
exit 1
|
||||
fi
|
||||
local rep rc text prof prof_max
|
||||
[ "$2" ] && prof_max="$2" || prof_max=4
|
||||
[ "$3" ] && prof=$3 || prof=0
|
||||
text="répertoire: $1 \n"
|
||||
for rep in $(ls $1); do
|
||||
prof=$(( $prof+1 ))
|
||||
[ -r "$1$rep" ] || continue
|
||||
if [ -d "$1$rep" ]; then
|
||||
[ "$prof" -gt "$prof_max" ] && continue || f__scandir "$1$rep/" "$prof_max" "$prof"
|
||||
else
|
||||
if cat $1$rep &>/dev/null ; then
|
||||
tempo="$(cat $1$rep)"
|
||||
[[ "$rep" == "uevent" || "$rep" == "modalias" ]] && rc=" \n" || unset rc
|
||||
[ "$tempo" ] && text+="$rep: $rc$tempo \n" || text+="$rep: <vide> \n"
|
||||
else
|
||||
text+="$rep: na \n"
|
||||
fi
|
||||
fi
|
||||
prof=$(( prof-1 ))
|
||||
done
|
||||
echo -e "$text"
|
||||
}
|
||||
|
||||
# $1=cmd si $2: nb de tentatives pour s'identifier, sinon 1 tentative par défaut
|
||||
f__sudo(){ # 11/10/2017
|
||||
local nb=1 sudo isudo
|
||||
|
@ -259,7 +288,7 @@ f__wget_test(){ # 08/10/2017
|
|||
exit 0
|
||||
}
|
||||
|
||||
f_help(){ # 12/10/2017
|
||||
f_help(){ # 13/10/2017
|
||||
printf "$BLUE"
|
||||
cat << 'EOF'
|
||||
----------------------------------------------------------------------
|
||||
|
@ -279,9 +308,9 @@ cat << 'EOF'
|
|||
--ssid : affiche configurations ssid, infos confidentielles, pas de rapport markdown,
|
||||
root et NetworkManager requis
|
||||
|
||||
--debug-batt : test batterie avec affichage BAT?/uevent et rapport markdown
|
||||
--debug-hw : test valeurs hwmon et rapport markdown
|
||||
--debug-dmi : test valeurs dmi et rapport markdown
|
||||
--debug-batt : scan valeurs power_supply et rapport markdown
|
||||
--debug-hw : scan valeurs hwmon et rapport markdown
|
||||
--debug-dmi : scan valeurs dmi et rapport markdown
|
||||
--debug-paste : le résultat json du paste sera affiché après export
|
||||
|
||||
-i, --install : installation du script dans le système, root requis
|
||||
|
@ -292,19 +321,13 @@ EOF
|
|||
echo -e "$STD\n plus d'infos: $GREEN$urlNotice\n$STD"
|
||||
}
|
||||
|
||||
fi_batt(){ # 12/10/2017
|
||||
[ "$fget_batt_nb" ] || figet_battery # appel figet_battery si pas déjà fait par fi_systeme
|
||||
fi_batt(){ # 13/10/2017
|
||||
[ "$fget_batt_nb" ] || figet_batt # appel figet_battery si pas déjà fait par fi_systeme
|
||||
[[ "$fget_batt_nb" == "-1" || "$fget_batt_nb" -gt 0 ]] || return 0
|
||||
text="## batterie(s) \n\n"
|
||||
text+='```\n'
|
||||
text+="$fget_batt\n"
|
||||
text+='```\n\n'
|
||||
if [ "$optDebug" == "debugBatt" ]; then
|
||||
text+='`cat /sys/class/power_supply/BAT?/uevent \n'
|
||||
text+='```\n'
|
||||
text+="$(< /sys/class/power_supply/BAT?/uevent) \n"
|
||||
text+='```\n'
|
||||
fi
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
|
@ -848,7 +871,7 @@ fi_system_analyse(){ # 25/09/2017
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_systeme(){ # 11/10/2017
|
||||
fi_systeme(){ # 13/10/2017
|
||||
local mbr description uname bootImage xorg shells lastboot uptime pluriel charge text
|
||||
[ -d /sys/firmware/efi ] && mbr="**EFI**" || mbr="**Legacy (mbr)**"
|
||||
[ -x "/usr/bin/lsb_release" ] && description="$(lsb_release -ds)" #dépend de apt install lsb-release, sur debian, en standard, juste : lsb-base
|
||||
|
@ -868,7 +891,7 @@ fi_systeme(){ # 11/10/2017
|
|||
cores="$(sort -u /proc/cpuinfo | grep -c '^core id')"
|
||||
thread="$(grep -c "^processor" /proc/cpuinfo)"
|
||||
###
|
||||
figet_battery
|
||||
figet_batt
|
||||
figet_cpu
|
||||
figet_de
|
||||
figet_dmi
|
||||
|
@ -929,7 +952,7 @@ fi_usb(){ # 25/09/2017
|
|||
}
|
||||
|
||||
# informations batterie(s), assigne $fget_batt_nb $fget_batt
|
||||
figet_battery(){ # 12/10/2017
|
||||
figet_batt(){ # 13/10/2017
|
||||
local batt_alim batt_unit batt_capa_design batt_capa_full batt_capa_now batt_conso batt_detail batt_nb
|
||||
local batt_voltage batt_status batt_sn batt_cycle alert_batterie tempo batt_restant ibat
|
||||
# batt_nb="$(grep 'Battery' /sys/class/power_supply/*/type | grep -c .)"
|
||||
|
@ -1019,6 +1042,24 @@ figet_battery(){ # 12/10/2017
|
|||
fi
|
||||
}
|
||||
|
||||
figet_batt_test(){ # 13/10/2017
|
||||
local text
|
||||
if [ ! -d "/sys/class/power_supply/" ]; then
|
||||
text="répertoire /sys/class/power_supply/ inexistant"
|
||||
return 1
|
||||
fi
|
||||
text="## batterie test \n\n"
|
||||
text+='```\n'
|
||||
text+="$(f__scandir "/sys/class/power_supply/" 2) \n"
|
||||
text+='```\n' >> "$fileOutput"
|
||||
figet_batt
|
||||
text+="figet_batt \n"
|
||||
text+='```\n'
|
||||
text+="$fget_batt \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
figet_cpu(){ # thanks neofetch, assigne $fget_cpu $fget_core # 10/10/2017
|
||||
local cpu speed_dir temp_dir speedMin speed speedMin speed temp cores thread plurielc plurielt
|
||||
cpu="$(gawk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)"
|
||||
|
@ -1195,28 +1236,24 @@ figet_dmi(){ # 12/10/2017
|
|||
fget_dmi=$(printf '%7s: %s' "produit" "$product")$' \n'
|
||||
[ "$indic1" != "$indic2" ] && fget_dmi+=$(printf '%7s: %s' "board" "$board")$' \n'
|
||||
fget_dmi+=$(printf '%7s: %s' "bios" "$bios")
|
||||
# for idmi in chassis_vendor chassis_version chassis_type; do
|
||||
# tempo=$(cat /sys/class/dmi/id/$idmi 2>/dev/null)
|
||||
# tempo=$(sed 's/x.xx*//' <<< $tempo)
|
||||
# [[ "$idmi" == "chassis_type" && "$tempo" == "10" ]] && tempo="Notebook"
|
||||
# chassis+="$tempo "
|
||||
# done
|
||||
# for idmi in chassis_vendor chassis_version chassis_type; do
|
||||
# tempo=$(cat /sys/class/dmi/id/$idmi 2>/dev/null)
|
||||
# tempo=$(sed 's/x.xx*//' <<< $tempo)
|
||||
# [[ "$idmi" == "chassis_type" && "$tempo" == "10" ]] && tempo="Notebook"
|
||||
# chassis+="$tempo "
|
||||
# done
|
||||
}
|
||||
|
||||
figet_dmi_test(){ # 13/10/2017
|
||||
#manuel: for i in $(ls /sys/class/dmi/id/); do printf "$i: "; cat /sys/class/dmi/id/$i; done
|
||||
local idmi text
|
||||
local text
|
||||
text="## dmi test \n\n"
|
||||
text+='```\n'
|
||||
for idmi in $(ls /sys/class/dmi/id/); do
|
||||
# [[ "$idmi" == "modalias" || "$idmi" == "uevent" ]] && continue
|
||||
[ -d "/sys/class/dmi/id/$idmi" ] && continue
|
||||
if [ -r "/sys/class/dmi/id/$idmi" ]; then
|
||||
text+="$idmi: $(cat /sys/class/dmi/id/$idmi) \n"
|
||||
else
|
||||
text+="$idmi: - \n"
|
||||
fi
|
||||
done
|
||||
text+="$(f__scandir "/sys/class/dmi/id/" 2) \n"
|
||||
text+='```\n' >> "$fileOutput"
|
||||
figet_dmi
|
||||
text+="figet_dmi \n"
|
||||
text+='```\n'
|
||||
text+="$fget_dmi \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
@ -1286,34 +1323,19 @@ figet_hw(){ # 13/10/2017
|
|||
}
|
||||
|
||||
figet_hw_test(){ # 13/10/2017
|
||||
local ihw ihwx text sensors
|
||||
[ "$(which sensors)" ] && sensors="$(sensors)"
|
||||
text="## hwmon test \n\n"
|
||||
local text
|
||||
text+="## hwmon test \n\n"
|
||||
text+='```\n'
|
||||
for ihw in $(ls /sys/class/hwmon/); do
|
||||
text+="$ihw \n"
|
||||
for ihwx in $(ls /sys/class/hwmon/$ihw/); do
|
||||
[ -d "/sys/class/hwmon/$ihw/$ihwx" ] && continue
|
||||
if [ -r "/sys/class/hwmon/$ihw/$ihwx" ]; then
|
||||
if [ "$(cat /sys/class/hwmon/$ihw/$ihwx)" ]; then
|
||||
text+="$ihwx: $(cat /sys/class/hwmon/$ihw/$ihwx) \n"
|
||||
else
|
||||
text+="$ihwx: -vide- \n"
|
||||
fi
|
||||
else
|
||||
text+="$ihwx: - \n"
|
||||
fi
|
||||
|
||||
done
|
||||
text+=" \n"
|
||||
done
|
||||
text+='```\n'
|
||||
if [ "$sensors" ]; then
|
||||
text+="$(f__scandir "/sys/class/hwmon/" 2) \n"
|
||||
text+='```\n' >> "$fileOutput"
|
||||
if [ "$(which sensors)" ]; then
|
||||
text+="sensors \n"
|
||||
text+='```\n'
|
||||
text+="$sensors \n"
|
||||
text+="$(sensors) \n"
|
||||
text+='```\n'
|
||||
fi
|
||||
figet_hw
|
||||
text+="figet_hw \n"
|
||||
text+='```\n'
|
||||
text+="$fget_hw \n"
|
||||
text+='```\n'
|
||||
|
@ -1886,9 +1908,8 @@ for j in $options; do
|
|||
f_help
|
||||
exit ;; # affichage help
|
||||
--debug-batt )
|
||||
optDebug="debugBatt"
|
||||
prg_1
|
||||
fi_batt
|
||||
figet_batt_test
|
||||
prg_3
|
||||
exit ;; # rapport batterie avec affichage /sys/class/power_supply/BAT?/uevent
|
||||
--debug-dmi )
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,9 +5,14 @@
|
|||
|
||||
* placer ln dans /usr/local/bin au lieu de /usr/bin ?
|
||||
* disk: comptage, pluriel, renommage variables publiques, révision, fin de lignes
|
||||
* figet_cpu, refaire si plusieurs core
|
||||
* figet_cpu, refaire
|
||||
---
|
||||
|
||||
## 2.5.0 13/10/2017
|
||||
|
||||
* réécriture: figet_dmi_test, figet_hw_test (f__scandir)
|
||||
* nouveau: figet_batt_test
|
||||
* figet_battery ->figet_batt
|
||||
|
||||
## 2.4.2 13/10/2017
|
||||
|
||||
|
|
Loading…
Reference in New Issue