mirror of https://framagit.org/kyodev/kyopages.git
1.0.1
This commit is contained in:
parent
a566fa4c69
commit
46849aea88
164
scripts/getInfo
164
scripts/getInfo
|
@ -380,9 +380,10 @@ get_distro() { # thanks neofetch, assigne $distro
|
|||
# Workarounds for distros that go against the os-release standard.
|
||||
[[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
|
||||
[[ -z "${distro// }" ]] && distro="$(awk -F '=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
||||
# for debian, add version
|
||||
grep -qi 'Debian' /etc/issue && distro="$(sed 's/"//g' <<< $distro) $(cat /etc/debian_version)"
|
||||
echo "test1 $distro"
|
||||
fi
|
||||
# for debian, add version
|
||||
grep -qi 'Debian' /etc/issue && distro="$(sed 's/"//g' <<< $distro) $(cat /etc/debian_version)"
|
||||
[[ -z "$distro" ]] && distro="$os (Unknown)"
|
||||
}
|
||||
|
||||
|
@ -634,6 +635,46 @@ fi_cpu(){
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_disk(){
|
||||
local fstab=$(grep -vE '#|^$' /etc/fstab)
|
||||
local disk_lsblk=$(lsblk -fi -o +SIZE -o +OWNER)
|
||||
local 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")
|
||||
local resume=$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume)
|
||||
local idSwap=$(grep -vE '#|^$' /etc/fstab | grep 'swap' | grep 'UUID' | sed -E 's/^UUID=([0-9a-Z-]*).*/\1/')
|
||||
local idResume=$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume | grep 'RESUME=' | grep 'UUID' | sed -E 's/^.*UUID=([0-9a-Z-]*).*/\1/')
|
||||
local diskAta=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^ata/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')
|
||||
local diskUsb=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^usb/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')
|
||||
local diskMmc=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^mmc/!d; /part/d; /\/mmcblk/!d; s/^.*\(mmcblk..*\)$/\1/')
|
||||
local diskNvme=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^nvme/!d; /part/d; /\/nvme/!d; s/^.*\(nvme...*\)$/\1/')
|
||||
|
||||
local text="## disque(s) \n\n"
|
||||
get_disk; text+="disque(s): $disk \n\n"
|
||||
|
||||
text+="**grep -vE '#|^$' /etc/fstab** (fstab) \n"
|
||||
text+='```\n'
|
||||
text+="$fstab \n"
|
||||
text+='```\n'
|
||||
text+="**lsblk -fi -o +SIZE -o +OWNER** (disques) \n"
|
||||
text+='```\n'
|
||||
text+="$disk_lsblk \n"
|
||||
text+='```\n'
|
||||
text+="**df -h ...** (utilisation disques) \n"
|
||||
text+='```\n'
|
||||
text+="$utilDisk \n"
|
||||
text+='```\n'
|
||||
text+="**grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume** (resume) \n"
|
||||
text+='```\n'
|
||||
text+="$resume \n"
|
||||
text+='```\n'
|
||||
[ "$idSwap" ] && [ "$idResume" ] && [ "$idSwap"!="$idResume" ] && text+="_vérifier la config resume_, l'UUID ne semble pas correspondre à celui du swap. en cas de multi-boot, vous pouvez utiliser _RESUME=auto_ ou _RESUME=/dev/sdx_ \n"
|
||||
text+="\n**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"
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only
|
||||
local text="## dmesg (erreur, warning ou critique) \n\n"
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
|
@ -677,46 +718,6 @@ fi_dmesg(){ # root only, si $1=dmesg rapport dmesg only
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_disk(){
|
||||
local fstab=$(grep -vE '#|^$' /etc/fstab)
|
||||
local disk_lsblk=$(lsblk -fi -o +SIZE -o +OWNER)
|
||||
local 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")
|
||||
local resume=$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume)
|
||||
local idSwap=$(grep -vE '#|^$' /etc/fstab | grep 'swap' | grep 'UUID' | sed -E 's/^UUID=([0-9a-Z-]*).*/\1/')
|
||||
local idResume=$(grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume | grep 'RESUME=' | grep 'UUID' | sed -E 's/^.*UUID=([0-9a-Z-]*).*/\1/')
|
||||
local diskAta=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^ata/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')
|
||||
local diskUsb=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^usb/!d; /part/d; /\/sd/!d; s/^.*\(sd..*\)$/\1/')
|
||||
local diskMmc=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^mmc/!d; /part/d; /\/mmcblk/!d; s/^.*\(mmcblk..*\)$/\1/')
|
||||
local diskNvme=$(ls -l /dev/disk/by-id/ | awk '{ print $9, $11 }' | sed '/^nvme/!d; /part/d; /\/nvme/!d; s/^.*\(nvme...*\)$/\1/')
|
||||
|
||||
local text="## disque(s) \n\n"
|
||||
get_disk; text+="disque(s): $disk \n\n"
|
||||
|
||||
text+="**grep -vE '#|^$' /etc/fstab** (fstab) \n"
|
||||
text+='```\n'
|
||||
text+="$fstab \n"
|
||||
text+='```\n'
|
||||
text+="**lsblk -fi -o +SIZE -o +OWNER** (disques) \n"
|
||||
text+='```\n'
|
||||
text+="$disk_lsblk \n"
|
||||
text+='```\n'
|
||||
text+="**df -h ...** (utilisation disques) \n"
|
||||
text+='```\n'
|
||||
text+="$utilDisk \n"
|
||||
text+='```\n'
|
||||
text+="**grep -Ev '#|^$' /etc/initramfs-tools/conf.d/resume** (resume) \n"
|
||||
text+='```\n'
|
||||
text+="$resume \n"
|
||||
text+='```\n'
|
||||
[ "$idSwap" ] && [ "$idResume" ] && [ "$idSwap"!="$idResume" ] && text+="_vérifier la config resume_, l'UUID ne semble pas correspondre à celui du swap. en cas de multi-boot, vous pouvez utiliser _RESUME=auto_ ou _RESUME=/dev/sdx_ \n"
|
||||
text+="\n**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"
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_gpu(){
|
||||
# local graphCards=$(lspci -nnk | grep -iEA 3 'vga|display|3d')
|
||||
local graphCards=$(lspci -nnvvv | grep -iEA 13 '^[0-9]+.*vga|display|3d')
|
||||
|
@ -815,18 +816,6 @@ fi_nm(){
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_ssid(){ # affiche configurations ssid
|
||||
[ $(which nmcli) ] || f__error "il faut NetworkManager"
|
||||
[ $EUID -eq 0 ] || f__error "il faut les droits root"
|
||||
local nm_ssid=$(grep -vE '#|^$' /etc/NetworkManager/system-connections/*)
|
||||
local text="## configuration(s) ssid networkmanager \n\n"
|
||||
f__info="$RED""Attention, la clé du réseau wifi est visible $COLOR""aucun rapport n'a été créé"
|
||||
text+='```\n'
|
||||
text+="$nm_ssid \n"
|
||||
text+='```\n'
|
||||
echo -e "$text"
|
||||
}
|
||||
|
||||
fi_nm_wifis(){
|
||||
[ -x $(which nmcli) ] && [ -z "$1" ] || return 0
|
||||
local nm_wifis=$(nmcli -f SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,BARS,SECURITY device wifi list)
|
||||
|
@ -841,9 +830,9 @@ fi_nm_wifis(){
|
|||
}
|
||||
|
||||
fi_reseau(){
|
||||
local netcards=$(lspci -nnk | grep -iEA 3 'network|ethernet')
|
||||
# local netcards=$(lspci -nnvvv | grep -iEA 12 'network|ethernet')
|
||||
local ip_a=$(ip address show)
|
||||
local netcards="$(lspci -nnk | grep -iEA 3 'network|ethernet')"
|
||||
# local netcards="$(lspci -nnvvv | grep -iEA 12 'network|ethernet')"
|
||||
local ip_a="$(ip address show)"
|
||||
local iwconfig=$(iwconfig 2>&1 | grep -v 'no wireless extensions' | grep -v '^$')
|
||||
local interfaces=$(sed '/^#/d;s/^wpa-psk [[:graph:]]\+/wpa-psk <WPA key removed>/;/^$/d;s/\(.*\)/\1 /' /etc/network/interfaces)
|
||||
local route=$(ip route show)
|
||||
|
@ -961,19 +950,44 @@ fi_sources(){
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_ssid(){ # affiche configurations ssid
|
||||
[ $(which nmcli) ] || f__error "il faut NetworkManager"
|
||||
[ $EUID -eq 0 ] || f__error "il faut les droits root"
|
||||
local nm_ssid=$(grep -vE '#|^$' /etc/NetworkManager/system-connections/*)
|
||||
local text="## configuration(s) ssid networkmanager \n\n"
|
||||
f__info="$RED""Attention, la clé du réseau wifi est visible $COLOR""aucun rapport n'a été créé"
|
||||
text+='```\n'
|
||||
text+="$nm_ssid \n"
|
||||
text+='```\n'
|
||||
echo -e "$text"
|
||||
}
|
||||
|
||||
fi_system_analyse(){
|
||||
local bootTime=$(systemd-analyze time)
|
||||
local bootBlame=$(systemd-analyze blame | head -n 20)
|
||||
|
||||
local text="## analyse boot \n\n"
|
||||
text+="$(sed 's/Startup finished in /durée de boot: /; s/userspace/espace utilisateur/' <<< $bootTime) \n\n"
|
||||
text+="**systemd-analyze blame | head -n 20** \n"
|
||||
text+='```\n'
|
||||
text+="$bootBlame \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_systeme(){
|
||||
[ -d /sys/firmware/efi ] && local mbr="**EFI boot**" || local mbr="Legacy boot"
|
||||
[ -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
|
||||
[ -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)
|
||||
uptime=$(sed 's/up/depuis/; s/days/jours/; s/day/jour/; s/hour[s]*/h/; s/minute[s]*/mn/' <<< $uptime)
|
||||
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)"
|
||||
uptime="$(sed 's/up/depuis/; s/days/jours/; s/day/jour/; s/hour[s]*/h/; s/minute[s]*/mn/' <<< $uptime)"
|
||||
|
||||
local text="## système \n\n"
|
||||
get_cpu; text+="**CPU: $cpu** \n"
|
||||
|
@ -984,7 +998,7 @@ fi_systeme(){
|
|||
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"
|
||||
[ $description ] && text+="description: $description \n"
|
||||
[ "$description" ] && text+="description: $description \n"
|
||||
text+="uname: $uname \n"
|
||||
text+="$bootImage \n"
|
||||
get_resolution; text+="résolution: $resolution \n"
|
||||
|
@ -1001,19 +1015,6 @@ fi_systeme(){
|
|||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_system_analyse(){
|
||||
local bootTime=$(systemd-analyze time)
|
||||
local bootBlame=$(systemd-analyze blame | head -n 20)
|
||||
|
||||
local text="## analyse boot \n\n"
|
||||
text+="$(sed 's/Startup finished in /durée de boot: /; s/userspace/espace utilisateur/' <<< $bootTime) \n\n"
|
||||
text+="**systemd-analyze blame | head -n 20** \n"
|
||||
text+='```\n'
|
||||
text+="$bootBlame \n"
|
||||
text+='```\n'
|
||||
echo -e "$text" >> "$fileOutput"
|
||||
}
|
||||
|
||||
fi_usb(){
|
||||
local lsusb=$(lsusb)
|
||||
local lsusb_t=$(lsusb -t)
|
||||
|
@ -1057,6 +1058,11 @@ prg_1(){ # début programme
|
|||
echo -e "Rapport au $dateRapport \n" >> "$fileOutput"
|
||||
}
|
||||
prg_2(){ # traitements principaux
|
||||
printf "."
|
||||
fi_systeme; printf "."
|
||||
fi_reseau; printf "."
|
||||
}
|
||||
prg_23(){ # traitements principaux
|
||||
printf "."
|
||||
fi_systeme; printf "."
|
||||
fi_cpu; printf "."
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## 1.0.1 17/08/2017
|
||||
|
||||
* fix bug: fi_systeme & get_distro(neofetch)
|
||||
|
||||
## 1.0.1 17/08/2017
|
||||
|
||||
* version publique
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue