getInfo 1.25.0

This commit is contained in:
kyodev 2017-09-25 23:38:39 +02:00
parent 8a38533260
commit da908555a6
2 changed files with 137 additions and 104 deletions

View File

@ -1,12 +1,10 @@
#!/bin/bash
version=1.24.0
date="24/09/2017"
version=1.25.0
date="25/09/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo"
urlScript="https://framagit.org/kyodev/kyopages/raw/master/scripts/$script"
urlNotice="https://kyodev.frama.io/kyopages/scripts/getInfo/"
##### license LPRAB/WTFPL
# auteur: simpledeb
@ -170,13 +168,15 @@ f__user(){ # 30/08/2017-4
return 0
}
# test wget, $1 url à tester, sortie script, sur erreur ou retour à la normale
# test wget, $1 url à tester, sortie du script si $1 seul (même si url testée ok)
# si $2=print affiche url testée & entêtes http & location (si présente) et sortie normale fonction
# si $2=loc affiche seulement location
f__wget_test(){ # 07/09/2017
# si $2=loc affiche seulement location et sortie normale fonction
# si $2=test return 0 si ok, return 1 si ko
f__wget_test(){ # 25/09/2017
local file_test_wget retourWget retourHttp location
file_test_wget="/tmp/testWget-$RANDOM"
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || retourWget="$?"
if [ "$2" == "test" ] && [ "$?" == "0" ]; then return 0; else return 1; fi
[ "$retourWget" == 1 ] && retourWget="code erreur générique"
[ "$retourWget" == 2 ] && retourWget="parse erreur (ligne de commande?)"
[ "$retourWget" == 3 ] && retourWget="erreur Entrée/sortie fichier"
@ -191,26 +191,23 @@ f__wget_test(){ # 07/09/2017
if [ "$retourWget" ]; then
echo "erreur wget: $RED$retourWget$COLOR"
echo -e "$BLUE $1$COLOR\t$RED $retourHttp$COLOR"
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOW no location"
echo "$COLOR"
return
else
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$YELLOW"
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOW no location"
echo "$COLOR"
return
echo -e "$BLUE $1$COLOR\t$GREEN $retourHttp$COLOR"
fi
fi
if [ "$2" == "loc" ]; then
[ "$location" ] && echo "$location" || echo "no location"
return
if [ "$2" == "print" ] || [ "$2" == "loc" ]; then
[ "$location" ] && echo "$YELLOW $location" || echo "$YELLOW no location"
echo "$COLOR"
return 0
fi
if [ "$retourWget" ]; then
rm "$file_test_wget"
f__error "erreur wget, $retourWget" "$1" "$YELLOW$retourHttp" \
"si persistance, contacter $projet $contact en indiquant les messages précédents"
fi
if [ "$(grep -c '200' <<< $retourHttp)" -ne 0 ]; then echo -e "$GREEN\ntout est ok, réessayer\n$COLOR"; fi
if [ "$(grep -c '200' <<< $retourHttp)" -ne 0 ]; then
echo -e "$GREEN\ntout est ok, réessayer\n$COLOR"
fi
rm "$file_test_wget"
exit 0
}
@ -252,10 +249,12 @@ fi_cpu(){ # 30/08/2017
###
text="## processeur / mémoire \n\n"
text+='```\n'
figet_cpu; text+="CPU: $cpu \n"
figet_cpu
text+="CPU: $cpu \n"
text+="adressage: $cpu_addr \n"
text+="bogomips: $cpu_bogomips \n"
figet_memory; text+="\nmémoire Ram utilisée/totale: $memory \n\n"
figet_memory
text+="\nmémoire Ram utilisée/totale: $memory \n\n"
text+="mémoire système: $memsys \n"
text+='```\n\n'
text+="flags cpu: \n"
@ -265,11 +264,13 @@ fi_cpu(){ # 30/08/2017
echo -e "$text" >> "$fileOutput"
}
fi_disk(){ # 16/09/2017
local fstab disk_lsblk utilDisk resume idResume idSwap diskAta diskUsb diskMmc diskNvme alert_uuidResume text
fi_disk(){ # 25/09/2017
local fstab disk_lsblk utilDisk resume idResume idSwap disk_detail disk_hotplug disk_fix
local diskAta diskUsb diskMmc diskNvm alert_uuidResume text
fstab="$(grep -vE '#|^$' /etc/fstab)"
disk_lsblk="$(lsblk -fi -o +SIZE -o +OWNER)"
utilDisk="$(df -h --output=source,target,fstype,size,used,avail,pcent --exclude=tmpfs --exclude=devtmpfs --exclude=devtmpfs | grep -Ev "devpts|none|proc|sys|tmpfs|udev")"
disk_lsblk="$(lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT,UUID,OWNER)"
utilDisk="$(df -h --output=source,target,fstype,size,used,avail,pcent --exclude=tmpfs --exclude=devtmpfs | grep -Ev 'devpts|none|proc|sys|tmpfs|udev')"
resume="$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume)"
# idResume="$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume | sed -En 's/^[^[:blank:]{1,}][^#{1,}].*UUID=(.*)$/\1/p')"
idResume="$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume | sed -En 's/.*UUID=([0-9a-Z-]*).*$/\1/p')"
@ -282,36 +283,40 @@ _vérifier la config resume_, l'UUID ne correspond pas à celui du swap. En cas
diskAta="$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^ata/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')"
diskUsb="$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^usb/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')"
diskMmc="$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^mmc/!d; /part/d; /\/mmcblk/!d; s/^.*\(mmcblk..*\)$/\1/')"
diskNvme="$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^nvme/!d; /part/d; /\/nvme/!d; s/^.*\(nvme...*\)$/\1/')"
diskNvm="$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^nvme/!d; /part/d; /\/nvme/!d; s/^.*\(nvme...*\)$/\1/')"
[ "$diskAta" ] || diskAta="-"
[ "$diskUsb" ] || diskUsb="-"
[ "$diskMmc" ] || diskMmc="-"
[ "$diskNvm" ] || diskNvm="-"
###
text="## disque(s) \n\n"
figet_disk; text+="disque(s): $disk \n\n"
text+="**grep -vE '#|^$' /etc/fstab** (fstab) \n"
figet_disk
text+="disque(s): $disk \n\n"
text+='``'"grep -vE '#|^$' /etc/fstab"'`` (fstab) \n' # fstab
text+='```\n'
text+="$fstab \n"
text+='```\n\n'
text+="**lsblk -fi -o +SIZE -o +OWNER** (disques) \n"
text+='``'"lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT,UUID,OWNER"'`` (disques) \n' # lsblk
text+='```\n'
text+="$disk_lsblk \n"
text+='```\n\n'
text+="**df -h ...** (utilisation disques) \n"
text+='``df -h --output=source,target,fstype,size,used,avail,pcent --exclude=tmpfs --exclude=devtmpfs`` (utilisation disques) \n' # df
text+='```\n'
text+="$utilDisk \n"
text+='```\n\n'
text+="**grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume** (resume) \n"
text+='``'"grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume"'`` (resume) \n' # resume
text+='```\n'
text+="$resume \n"
text+='```\n\n'
[ "$alert_uuidResume" ] && text+="$alert_uuidResume \n"
text+="**types de disque** \n\n"
[ "$diskAta" ] || diskAta="-"; text+="* ata: $diskAta \n"
[ "$diskUsb" ] || diskUsb="-"; text+="* usb: $diskUsb \n"
[ "$diskMmc" ] || diskMmc="-"; text+="* mmc: $diskMmc \n"
[ "$diskNvme" ] || diskNvme="-"; text+="* nvme: $diskNvme \n"
text+="| ata | usb | mmc | nvme | \n"
text+="| :---: | :---: | :---: | :---: | \n"
text+="| $diskAta | $diskUsb | $diskMmc | $diskNvm | \n"
echo -e "$text" >> "$fileOutput"
}
fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only # 24/09/2017
fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only # 25/09/2017
local text dmesg_err dmesg_warn dmesg_crit
text="## dmesg (erreur, warning ou critique) \n\n"
if [ "$EUID" -ne 0 ]; then
@ -324,19 +329,19 @@ fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only # 24/09/2017
dmesg_warn="$(dmesg -l warn)"
dmesg_crit="$(dmesg -l crit)"
if [ "$dmesg_err" ]; then
text+="**dmesg -l err** (erreur) \n"
text+='``dmesg -l err`` (erreur) \n'
text+='```\n'
text+="$dmesg_err \n"
text+='```\n'
fi
if [ "$dmesg_warn" ]; then
text+="**dmesg -l warn** (warning) \n"
text+='``dmesg -l warn`` (warning) \n'
text+='```\n'
text+="$dmesg_warn \n"
text+='```\n'
fi
if [ "$dmesg_crit" ]; then
text+="**dmesg -l crit** (critique) \n"
text+='``dmesg -l crit`` (critique) \n'
text+='```\n'
text+="$dmesg_crit \n"
text+='```\n'
@ -347,8 +352,8 @@ fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only # 24/09/2017
echo -e "$text" >> "$fileOutput"
}
fi_gpu(){ # 23/09/2017
local slotGraphCards graphCards openGl resolutions extraitXorg text
fi_gpu(){ # 25/09/2017
local slotGraphCards graphCards openGl resolutions logXorg text
# graphCards="$(lspci -nnk | grep -iEA 3 'vga|display|3d')"
# graphCards="$(lspci -nnv | grep -iEA 13 '^[0-9]+.*vga|display|3d')"
slotGraphCards="$(lspci | grep -iE 'vga|display|3d' | sed -En 's/^([0-9.:]+).*$/\1/gp')"
@ -359,37 +364,39 @@ fi_gpu(){ # 23/09/2017
done
unset i
graphCards="$(echo -e "$graphCards")"
[ "$(which glxinfo)" ] && openGl="$(glxinfo | grep 'OpenGL version string:')"
[ "$(which glxinfo)" ] && openGl="$(glxinfo | grep 'OpenGL version')"
resolutions="$(xrandr --query | grep '^ *[0-9]' | head -n 10)"
extraitXorg="$(grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/$user_/.local/share/xorg/Xorg.*.log 2>/dev/null)"
logXorg="$(grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/$user_/.local/share/xorg/Xorg.*.log 2>/dev/null)"
###
text="## graphisme \n\n"
text+="| | | \n"
text+=" --- | --- \n"
figet_gpu; text+="GPU | **$gpu** \n\n"
figet_resolution; text+="**résolution: $resolution** \n\n"
text+="**lspci -nnv | grep -iEA 13 'vga|display|3d'** \n"
figet_gpu
text+="GPU | **$gpu** \n\n"
figet_resolution
text+="**résolution: $resolution** \n\n"
text+='``'"lspci -nnv | grep -iEA 13 'vga|display|3d'"'`` \n'
text+="$graphCards \n\n"
if [ "$openGl" ]; then
text+="**glxinfo | grep 'OpenGL version string:'** \n"
text+='``'"glxinfo | grep 'OpenGL version'"'`` \n'
text+='```\n'
text+="$openGl \n"
text+='```\n\n'
fi
text+="**xrandr --query | grep '^ *[0-9]' | head -n 10** (10 premières résolutions possibles) \n"
text+='``'"xrandr --query | grep '^ *[0-9]' | head -n 10"'`` (10 premières résolutions possibles) \n'
text+='```\n'
text+="$resolutions \n"
text+='```\n\n'
text+="**grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/user/.local/share/xorg/Xorg.*.log** (extrait xorg.log) \n"
[ "$noHome" == "true" ] && text+="attention pas de home utilisateur détecté \n"
text+='``'"grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.?.log /home/user/.local/share/xorg/Xorg.?.log"'`` (xorg.log) \n'
text+='```\n'
text+="$extraitXorg \n"
text+="$logXorg \n"
text+='```\n\n'
figet_modules video; text+="$exportText"
figet_modules video
text+="$exportText"
echo -e "$text" >> "$fileOutput"
}
fi_localisation(){ # 16/09/2017
fi_localisation(){ # 25/09/2017
local locale timezone keymap keyboard timedatectl alert_Rtc alert_Rtc_info alert_NTP alert_Ntp_info text
locale="$(grep -vE '#|^$' /etc/default/locale)"
timezone="$(cat /etc/timezone)"
@ -408,66 +415,66 @@ et/ou installer le démon Ntp: apt install ntp \n"
keyboard="$(grep -vE '#|^$' /etc/default/keyboard)"
###
text="## localisation \n\n"
text+="**grep -vE '#|^$' /etc/default/locale** \n"
text+='``'"grep -vE '#|^$' /etc/default/locale"'`` \n'
text+='```\n'
text+="$locale \n"
text+='```\n\n'
text+="**cat /etc/timezone** \n"
text+='``'"cat /etc/timezone"'`` \n'
text+='```\n'
text+="$timezone \n"
text+='```\n'
if [ "$timedatectl" ]; then
text+="**timedatectl status --no-pager** \n"
text+='\n``'"timedatectl status --no-pager"'`` \n'
text+='```\n'
text+="$timedatectl \n"
text+='```\n'
fi
[ "$alert_Rtc" ] && text+="$alert_Rtc_info \n"
[ "$alert_Ntp" ] && text+="$alert_Ntp_info \n"
text+="\n**setxkbmap -query** \n"
text+='\n``'"setxkbmap -query"'`` \n'
text+='```\n'
text+="$keymap \n"
text+='```\n\n'
text+="**grep -vE '#|^$' /etc/default/keyboard** \n"
text+='``'"grep -vE '#|^$' /etc/default/keyboard"'`` \n'
text+='```\n'
text+="$keyboard \n"
text+='```\n\n'
echo -e "$text" >> "$fileOutput"
}
fi_nm(){ # 30/08/2017
fi_nm(){ # 25/09/2017
[ -x "$(which nmcli)" ] || return 0 # nécessite root sur autre que debian?
local nm_etat nm_conf text
nm_etat="$(grep -vE '#|^$' /var/lib/NetworkManager/NetworkManager.state)"
nm_conf="$(grep -vE '#|^$' /etc/NetworkManager/NetworkManager.conf)"
###
text="## Network Manager \n\n"
text+="**grep -vE '#|^$' /var/lib/NetworkManager/NetworkManager.state** \n"
text+='``'"grep -vE '#|^$' /var/lib/NetworkManager/NetworkManager.state"'`` \n'
text+='```\n'
text+="$nm_etat \n"
text+='```\n\n'
text+="**grep -vE '#|^$' /etc/NetworkManager/NetworkManager.conf** \n"
text+='``'"grep -vE '#|^$' /etc/NetworkManager/NetworkManager.conf"'`` \n'
text+='```\n'
text+="$nm_conf \n"
text+='```\n\n'
echo -e "$text" >> "$fileOutput"
}
fi_nm_wifis(){ # 24/09/2017
fi_nm_wifis(){ # 25/09/2017
[ -x "$(which nmcli)" ] || return 0
local nm_wifis nm_connected text
nm_wifis="$(nmcli -f SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,BARS,SECURITY device wifi list)"
nm_connected="$(LC_ALL=C nmcli -f SSID,ACTIVE,IN-USE device wifi list | grep -E 'yes[[:space:]]+\*' | awk '{print $1}')" # non utilisé
###
text="## wifis à proximité \n\n"
text+="**nmcli -f SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,BARS,SECURITY device wifi list** \n"
text+='``'"nmcli -f SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,BARS,SECURITY device wifi list"'`` \n'
text+='```\n'
text+="$nm_wifis \n"
text+='```\n'
echo -e "$text" >> "$fileOutput"
}
fi_nonFree(){ # 24/09/2017
fi_nonFree(){ # 25/09/2017
local vrmsOut text
if [ "$(which vrms)" ]; then
vrmsOut="$(vrms)"
@ -476,13 +483,16 @@ fi_nonFree(){ # 24/09/2017
fi
###
text="## Paquets non-libres \n\n"
[ "$(which vrms)" ] && text+='```\n'
if [ "$(which vrms)" ]; then
text+='``vrms`` \n'
text+='```\n'
fi
text+="$vrmsOut \n"
[ "$(which vrms)" ] && text+='```\n'
echo -e "$text" >> "$fileOutput"
}
fi_reseau(){ # 23/09/2017
fi_reseau(){ # 25/09/2017
local slotNetCards netCards ip_a iwconfig interfaces route resolv text liste_canaux_wifi
# netCards="$(lspci -nnk | grep -iEA 5 'network|ethernet')"
# netCards="$(lspci -nnv | grep -iEA 15 'network|ethernet')"
@ -513,7 +523,8 @@ fi_reseau(){ # 23/09/2017
liste_canaux_wifi="$(iwlist chan 2>&1 | grep -vE 'no frequency information|^$')"
fi
###
figet_ip; text+="**IP locale(s):** \n"
figet_ip
text+="**IP locale(s):** \n"
text+='```\n'
text+="$ip_local_type \n"
text+='```\n\n'
@ -528,32 +539,32 @@ fi_reseau(){ # 23/09/2017
text+="$gateway_type \n"
text+='```\n\n'
text+="* l'IP publique peut être connue avec: "'`./getInfo --ip` ou `getInfo --ip` (script installé) \n\n'
text+="**lspci -nnv | grep -iEA 15 'network|ethernet'** \n"
text+='``'"lspci -nnv | grep -iEA 15 'network|ethernet"'`` \n'
text+="$netCards \n\n"
text+="**ip address** (ipv6 lien local, pas d'adresses MAC) \n"
text+='```\n'
text+="$ip_a \n"
text+='```\n\n'
if [ "$iwconfig" ]; then
text+="**iwconfig** \n"
text+='``iwconfig`` \n'
text+='```\n'
text+="$iwconfig \n"
text+='```\n\n'
fi
text+="**/etc/network/interfaces** \n"
text+='``cat /etc/network/interfaces`` \n'
text+='```\n'
text+="$interfaces \n"
text+='```\n\n'
text+="**ip route show** \n"
text+='``ip route show`` \n'
text+='```\n'
text+="$route \n"
text+='```\n\n'
text+="**/etc/resolv.conf** \n"
text+='``cat /etc/resolv.conf`` \n'
text+='```\n'
text+="$resolv \n"
text+='```\n\n'
if [ "$liste_canaux_wifi" ]; then
text+="**iwlist chan** \n"
text+='``iwlist chan`` \n'
text+='```\n'
text+="$liste_canaux_wifi \n"
text+='```\n\n'
@ -563,13 +574,14 @@ fi_reseau(){ # 23/09/2017
text+="### network managers \n\n"
[ "$netmgrinst" ] && text+="installé(s): **$netmgrinst** \n" || text+="non trouvé parmi: ${netmgrnames[@]} \n"
text+="en fonctionnement: "
[ "$netmgrrun" ] && text+="**$netmgrrun** \n" || text+="non trouvé \n"
figet_modules net; text+="$exportText"
[ "$netmgrrun" ] && text+="**$netmgrrun** \n" || text+="non \n"
figet_modules net
text+="$exportText"
fi
echo -e "$text" >> "$fileOutput"
}
fi_sources(){ # 22/09/2017
fi_sources(){ # 25/09/2017
[ "$(which apt)" ] || return 0 # retour si pas d'apt ? et aptitude...????
local sources dateMaj apt autoremove paquetToRemove httpredir upgradable nbUpgradable dpkgArch paquetBiz text
printf "."
@ -588,11 +600,11 @@ fi_sources(){ # 22/09/2017
paquetBiz="$(dpkg -l | grep -v '^i' | grep "$dpkgArch" | awk '{print $1, $2, $3}')"
###
text+="## sources list \n\n"
text+="**grep -rvE '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null** \n"
text+='``'"grep -rvE '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null"'`` \n'
text+='```\n'
text+="$sources \n"
text+='```\n\n'
text+="dernière mise à jour **apt**: $dateMaj \n\n"
text+="dernière mise à jour **apt: $dateMaj** \n\n"
if [ "$autoremove" -ne 0 ] ; then
text+="**$autoremove paquet(s) installé(s) inutile(s)**, vous pouvez utiliser: "'`apt autoremove`'" \n"
text+="paquet(s) concerné(s): \n"
@ -608,7 +620,7 @@ fi_sources(){ # 22/09/2017
fi
if [ "$upgradable" ]; then
text+="**$nbUpgradable paquets devraient être mis à jour:** \n"
text+="**apt list --upgradable** \n"
text+='``apt list --upgradable`` \n'
text+='```\n'
text+="$upgradable \n"
text+='```\n\n'
@ -623,7 +635,7 @@ fi_sources(){ # 22/09/2017
echo -e "$text" >> "$fileOutput"
}
fi_ssid(){ # affiche configurations ssid # 04/09/2017
fi_ssid(){ # affiche configurations ssid # 25/09/2017
[ "$(which nmcli)" ] || f__error "il manque NetworkManager"
[ $EUID -eq 0 ] || f__error "il manque les droits root"
local nm_ssid text
@ -631,13 +643,12 @@ fi_ssid(){ # affiche configurations ssid # 04/09/2017
###
f__info "$RED""Attention, la clé du réseau wifi est visible $COLOR""aucun rapport n'a été créé"
text="## configuration(s) ssid networkmanager \n\n"
text+='```\n'
text+="$nm_ssid \n"
text+='```\n'
text+="$GREEN""grep -vE '#|^$' /etc/NetworkManager/system-connections/*$COLOR \n\n"
text+="$nm_ssid \n\n"
echo -e "$text"
}
fi_system_analyse(){ # 30/08/2017
fi_system_analyse(){ # 25/09/2017
[ -x "$(which systemd-analyze)" ] || return 0 # pas systemd
local bootTime bootBlame text
bootTime="$(systemd-analyze time)"
@ -645,7 +656,7 @@ fi_system_analyse(){ # 30/08/2017
###
text="## analyse boot \n\n"
text+="$(sed 's/Startup finished in /**durée de boot:** /; s/userspace/espace utilisateur/; s/= \(.*\)$/= **\1**/' <<< $bootTime) \n\n"
text+="**systemd-analyze blame | head -n 20** \n"
text+='``systemd-analyze blame | head -n 20`` \n'
text+='```\n'
text+="$bootBlame \n"
text+='```\n\n'
@ -671,10 +682,13 @@ fi_systeme(){ # 22/09/2017
text="## système \n\n"
text+="| | | \n"
text+=" --- | --- \n"
figet_cpu; text+="CPU | **$cpu** \n"
figet_gpu; text+="GPU | **$gpu** \n"
figet_cpu
text+="CPU | **$cpu** \n"
figet_gpu
text+="GPU | **$gpu** \n"
text+="boot | $mbr \n"
figet_distro; text+="distribution | **$distro** \n\n"
figet_distro
text+="distribution | **$distro** \n\n"
f__architecture || f__info "Architecture non supportée" "vous pouvez contacter contacter $projet $contact si vous voulez aider à parfaire le script"
text+='```\n'
text+="architecture: $architecture \n"
@ -688,30 +702,36 @@ fi_systeme(){ # 22/09/2017
# ps ax | awk '$1=="1"{print $5}') affiche le 1er process daemon init, normalement /sbin/init
text+="$(sed -En 's/^.* (\/.*$)/\1/p' <<< $(ls -l $(ps ax | awk '$1=="1"{print $5}'))) \n"
fi
figet_resolution; text+="résolution: $resolution \n"
figet_resolution
text+="résolution: $resolution \n"
text+="serveur d'affichage: $xorg \n"
figet_de; text+="desktop (DE): $de \n"
figet_wm; text+="window manager: $wm \n"
figet_shell; text+="shell actif: $shell \n"
figet_de
text+="desktop (DE): $de \n"
figet_wm
text+="window manager: $wm \n"
figet_shell
text+="shell actif: $shell \n"
text+="shells installés: $shells \n"
figet_disk; text+="disque(s): $disk \n"
figet_battery; text+="batteries(s): $battery \n"
figet_disk
text+="disque(s): $disk \n"
figet_battery
text+="batteries(s): $battery \n"
text+="dernier boot: $lastboot, uptime: $uptime \n"
text+='```\n\n'
echo -e "$text" >> "$fileOutput"
}
fi_usb(){ # 30/08/2017
fi_usb(){ # 25/09/2017
local lsusb lsusb_t text
lsusb="$(lsusb)"
lsusb_t="$(lsusb -t)"
###
text="## périphériques USB \n\n"
text+="**lsusb** \n"
text+='``lsusb`` \n'
text+='```\n'
text+="$lsusb \n"
text+='```\n\n'
text+="**lsusb -t** \n"
text+='``lsusb -t`` \n'
text+='```\n'
text+="$lsusb_t \n"
text+='```\n\n'
@ -804,7 +824,7 @@ figet_disk() { # thanks neofetch, assigne $disk # 30/08/2017
disk_used="${disk#*:}"
disk_used="${disk_used%%:*}"
disk_total="${disk%%:*}"
disk_total_per="${disk#*:*:}"
disk_total_per="${disk#*:*:}" # %
# Put it all together
disk="${disk_used} / ${disk_total} (${disk_total_per})"
}
@ -1197,6 +1217,10 @@ fscript_update(){ # 06/09/2017
# initialisation
PATH='/usr/sbin:/usr/bin:/sbin:/bin'; TERM=xterm ; IFS=$' \t\n'
export PATH TERM IFS
urlScript="https://frama.link/getinfo"
f__wget_test "$urlNotice" test || urlScript="https://framagit.org/kyodev/kyopages/raw/master/scripts/$script"
urlNotice="https://frama.link/doc-getinfo"
f__wget_test "$urlNotice" test || urlNotice="https://kyodev.frama.io/kyopages/scripts/getInfo/"
fileOutput="getInfo_rapport.md"
fileLogs="/var/log/sdeb_$script.log"
fileDev="/opt/bin/fileDev"
@ -1208,17 +1232,16 @@ if [ "$retourFUser" -eq 2 ]; then
f__info "user détecté, mais pas de home: /home/$user_"
noHome="true"
fi
f__requis "gawk wget curl ip>iproute2" # requis pour fonctionnement programme
f__requis "awk>gawk wget curl ip>iproute2" # requis pour fonctionnement programme
prg_1(){ # début
rm "$fileOutput" &>/dev/null
touch "$fileOutput"
chown $user_: "$fileOutput"
os="$(uname -s)"
hote="$(uname -n)"
dateRapport="$(date +"%d %b %Y %H:%M %z")"
echo -e "# getInfo $version sur $hote / $os \n" > "$fileOutput"
echo -e "Rapport du $dateRapport \n" >> "$fileOutput"
echo -e "# $script sur $hote \n" > "$fileOutput"
echo -e "Rapport du $dateRapport -- [$script $version]($urlNotice) \n" >> "$fileOutput"
}
prg_2(){ # traitements principaux
printf " ."
@ -1238,7 +1261,7 @@ prg_2(){ # traitements principaux
}
prg_3(){ # fin de traitements
echo -e "--- \n" >> "$fileOutput"
echo -e "[getInfo v$version]($urlNotice) * $(date '+%a %d/%m/%Y %k:%M:%S')\n" >> "$fileOutput"
echo -e "[$script $version]($urlNotice) -- $dateRapport\n" >> "$fileOutput"
f__dialog_oui_non "non" "exporter sur un pastebin par défaut?" && fipaste
f__info "\n le rapport est disponible en local, fichier:$GREEN $fileOutput"
f__info "vous pouvez le visualiser avec $GREEN$script -l$COLOR"
@ -1320,5 +1343,7 @@ done
unset j
exit 0
wget -O getInfo https://framagit.org/kyodev/kyopages/raw/master/scripts/getInfo
wget -O getInfo https://frama.link/getinfo
chmod +x getInfo && ./getInfo
wget -O getInfo https://framagit.org/kyodev/kyopages/raw/master/scripts/getInfo

View File

@ -3,8 +3,16 @@
## todo
* placé ln dans /usr/local/bin au lieu de /usr/bin ?
* placer ln dans /usr/local/bin au lieu de /usr/bin ?
* virer f__user
* revoir partitions/disques
* requis curl uniquement pour paste
## 1.25.0 25/09/2017
* f__wget_test(): nouvelle option test
* liens raccourcis frama.link
* commandes: présentation markdown
## 1.24.0 24/09/2017