mirror of https://framagit.org/kyodev/kyopages.git
0.9.0
This commit is contained in:
parent
67cbac0289
commit
9bdb7807d1
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.8.0
|
||||
date="08/2017"
|
||||
version=0.9.0
|
||||
date="06/08/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues"
|
||||
script="getInfo"
|
||||
|
@ -374,9 +374,14 @@ get_gpu() { # thanks neofetch, assigne $gpu
|
|||
[[ "$gpu" =~ "intel" ]] && gpu="Intel Integrated Graphics"
|
||||
}
|
||||
|
||||
get_ip() { # assigne $ip_local
|
||||
ip_local=$(ip route get 1 | awk '/via/ {print $5, ":",$3}')
|
||||
gateway=$(ip route | awk '/via/ {print "passerelle:", $3, "pour:", $5}')
|
||||
get_ip() { # $ip_local, $gateway, $gateway_type, $gateway_one, $ip_local, $ip_local_type, $ifname, $ifname_type
|
||||
gateway=$(ip route | awk '/default.*via/ {print $3, "pour:", $5}')
|
||||
gateway_type=$(sed 's/\(^.*wl.*\)/\1 (wifi)/;s/\(^.*en.*\)/\1 (ethernet)/' <<< $gateway)
|
||||
gateway_one=$(head -n 1 <<< $gateway | awk '{print $1}')
|
||||
ip_local=$(ip route | awk '/proto.*src/ {print $9, "pour:",$3}')
|
||||
ip_local_type=$(sed 's/\(^.*wl.*\)/\1 (wifi)/;s/\(^.*en.*\)/\1 (ethernet)/' <<< $ip_local)
|
||||
ifname=$(ip route | awk '/proto.*src/ {print $3}')
|
||||
ifname_type=$(sed 's/\(^wl.*\)/\1 (wifi)/;s/\(^en.*\)/\1 (ethernet)/' <<< $ifname)
|
||||
}
|
||||
|
||||
get_ip_public(){ # $1=IPv4|IPv6, assigne $ip_public
|
||||
|
@ -689,7 +694,7 @@ fi_disk(){
|
|||
fi_gpu(){
|
||||
# local graphCards=$(lspci -nnk | grep -iEA 3 'vga|display|3d')
|
||||
local graphCards=$(lspci -nnvvv | grep -iEA 13 '^[0-9]+.*vga|display|3d')
|
||||
local extraitXorg=$(cat /var/log/Xorg.0.log | grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)')
|
||||
local extraitXorg=$(grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/$user_/.local/share/xorg/Xorg.*.log)
|
||||
local resolutions=$(xrandr --query | grep '^ *[0-9]' | head -n 10)
|
||||
|
||||
local text="## graphisme \n\n"
|
||||
|
@ -703,7 +708,7 @@ fi_gpu(){
|
|||
text+='```\n'
|
||||
text+="$resolutions \n"
|
||||
text+='```\n'
|
||||
text+="**cat /var/log/Xorg.0.log | grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)'** (extrait xorg.log) \n"
|
||||
text+="**grep -E '\(WW\)|\(EE\)|\(NI\)|\(\?\?\)' /var/log/Xorg.*.log /home/user/.local/share/xorg/Xorg.*.log** (extrait xorg.log) \n"
|
||||
text+='```\n'
|
||||
text+="$extraitXorg \n"
|
||||
text+='```\n'
|
||||
|
@ -813,12 +818,18 @@ fi_reseau(){
|
|||
local text="## réseau \n\n"
|
||||
if which iwlist &>/dev/null; then # liste canaux wifi paquet wireless-tools requis
|
||||
local liste_canaux_wifi=$(iwlist chan 2>&1 | grep -vE 'no frequency information|^$')
|
||||
echo TEST
|
||||
fi
|
||||
|
||||
get_ip; text+="**IP locale $ip_local** \n\n"
|
||||
text+="l'IP publique n'apparaît pas pour ne pas être publiée, mais elle peut être connue avec: \n"
|
||||
text+=" ./getInfo --ip ou getInfo --ip (script installé) \n\n"
|
||||
get_ip; text+="**IP locale(s):** \n"
|
||||
text+='```\n'
|
||||
text+="$ip_local_type \n"
|
||||
text+='```\n'
|
||||
text+="**Passerelle(s):** \n"
|
||||
text+='```\n'
|
||||
text+="$gateway \n"
|
||||
text+='```\n'
|
||||
text+="l'IP publique n'apparaît pas pour ne pas être publiée, mais elle peut être connue avec: \n"
|
||||
text+='`'"./getInfo --ip ou getInfo --ip (script installé)"'`\n\n'
|
||||
text+="**lspci -nnk | grep -iEA 3 'network|ethernet'** \n"
|
||||
text+='```\n'
|
||||
text+="$netcards \n"
|
||||
|
@ -847,9 +858,9 @@ fi_reseau(){
|
|||
text+='```\n'
|
||||
if [ "$NETMGRINST" ]; then
|
||||
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"
|
||||
[ "$NETMGRINST" ] && text+="installé(s): **$NETMGRINST** \n" || text+="non trouvé parmi: ${NETMGRNAMES[@]} \n"
|
||||
text+="en fonctionnement: "
|
||||
[ "$netmgrrun" ] && text+="**$netmgrrun** \n" || text+="non trouvé \n"
|
||||
get_modules net; text+="$exportText"
|
||||
fi
|
||||
if [ "$liste_canaux_wifi" ]; then
|
||||
|
@ -896,6 +907,10 @@ fi_systeme(){
|
|||
[ -x "/usr/bin/lsb_release" ] && local description=$(lsb_release -ds) #dépend de apt install lsb-release, sur debian, en standard, juste : lsb-base
|
||||
local uname=$(uname -rmo)
|
||||
local bootImage=$(sed 's/root=[^ ]*//;s/[ ]\+/, /g' /proc/cmdline)
|
||||
local xorg=$XDG_SESSION_TYPE
|
||||
if [ -z "$xorg" ]; then
|
||||
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && xorg="wayland" || xorg="indéterminé"
|
||||
fi
|
||||
local shells=$(grep -v "^#" /etc/shells | sed 's/\/bin\///' | tr '\n' ' ')
|
||||
local lastboot=$(last -R -n 1 --time-format iso reboot | head -n 1 | grep -o '[0-9:T+-]*' | sed 's/T/ /')
|
||||
local uptime=$(uptime -p)
|
||||
|
@ -914,6 +929,7 @@ fi_systeme(){
|
|||
text+="uname: $uname \n"
|
||||
text+="$bootImage \n"
|
||||
get_resolution; text+="résolution: $resolution \n"
|
||||
text+="serveur xorg: $xorg \n"
|
||||
get_de; text+="desktop (DE): $de \n"
|
||||
get_wm; text+="window manager: $wm \n"
|
||||
get_shell; text+="shell actif: $shell \n"
|
||||
|
@ -921,6 +937,7 @@ fi_systeme(){
|
|||
get_disk; text+="disque(s): $disk \n"
|
||||
get_battery; text+="batteries(s): $battery \n"
|
||||
text+="dernier boot: $lastboot, uptime: $uptime \n"
|
||||
get_ip; text+="$ip_local_type \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
@ -963,16 +980,18 @@ fi_paste(){
|
|||
|
||||
# initialisation
|
||||
f__affichage
|
||||
|
||||
f__user
|
||||
fileOutput="getInfo_rapport.md"
|
||||
rm "$fileOutput" &>/dev/null
|
||||
touch "$fileOutput"
|
||||
chown $user_: "$fileOutput"
|
||||
|
||||
fileLogs="/var/log/sdeb_$script.log"
|
||||
dureePaste=1 # en jour
|
||||
|
||||
prg_1(){ # début
|
||||
f__requis "curl gawk"
|
||||
fi__context
|
||||
f__user
|
||||
}
|
||||
prg_2(){ # traitements principaux
|
||||
os=$(uname -s)
|
||||
|
@ -1038,6 +1057,15 @@ done
|
|||
printf $COLOR
|
||||
exit
|
||||
|
||||
prg_2(){ # traitements principaux
|
||||
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 au $dateRapport \n" >> "$fileOutput"
|
||||
fi_systeme
|
||||
}
|
||||
|
||||
bug markdownshare:
|
||||
'```' pas interprêté en <pre><code>
|
||||
|
|
Loading…
Reference in New Issue