Commit e7e0fa96 authored by kyodev's avatar kyodev

getInfo 4.4.0

parent 6f1c0d00
Pipeline #46728 failed with stage
in 20 seconds
......@@ -7,8 +7,8 @@
# SC2119 Use function "$@" if function's $1 should mean script's $1 (??)
# SC2129 Consider using { cmd1; cmd2; } >> file ... (erreur détection?)
version=4.3.0
date="08/03/2018"
version=4.4.0
date="08/04/2018"
contact="IRC freenode.net ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo"
......@@ -468,7 +468,7 @@ f__wget_test(){ # 22/02/2018
exit 0
}
f_affichage(){ # 09/03/2018
f_affichage(){ # 12/03/2018
local affichage_text=" _ ___ __
__ _ ___| |_|_ _|_ __ / _| ___
/ _' |/ _ \ __|| || '_ \| |_ / _ \
......@@ -478,7 +478,7 @@ f_affichage(){ # 09/03/2018
(( x_logo == 1 )) && return
x_logo=1
clear
clear 2>/dev/null || tput clear 2>/dev/null
echo -e "$BLUE$affichage_text$YELLOW version $version - $date$STD\n"
}
......@@ -890,7 +890,6 @@ fi_audio(){ # 06/03/2018
cmd_aplay="aplay -l | grep 'carte'"
cmt_arecord="périphériques de capture"
cmt_aplay="périphériques de lecture"
# modules alsa
mod_alsa=$( awk '{ print $2 }' /proc/asound/modules )
mod_alsa=$( sort <<< "$mod_alsa" )
......@@ -1033,8 +1032,8 @@ fi_cpu(){ # 08/03/2018
# shellcheck disable=SC2086
# SC2086 Double quote to prevent globbing and word splitting
# (certaines variables ne sont pas quotées pour permettre les traitements avec liste, ex: df)
fi_disk(){ # 08/03/2018
local cmd_dd_temp="" dd_temp="" liste_df disk_df disk_df_i cmd_dfi cmd_dfh disk_lsblk fstab
fi_disk(){ # 13/03/2018
local cmd_dd_temp="" dd_temp="" liste_df disk_df disk_df_i cmd_dfi cmd_dfh disk_lsblk fstab crypttab
local resume idResume idSwap idisk text pluriel
local alert_dd_temp alert_file_resume alert_uuidResume
......@@ -1065,8 +1064,9 @@ fi_disk(){ # 08/03/2018
# lsblk répertoire disques & partitions
disk_lsblk=$( lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT,UUID )
disk_lsblk=$( f__unit_french "$disk_lsblk" )
# fstab
# fstab & crypttab éventuel
fstab=$( f_grep_file "/etc/fstab" "sources notitre" )
crypttab=$( f_grep_file "/etc/crypttab" "sources notitre" )
# resume
resume=$( f_grep_file "/etc/initramfs-tools/conf.d/resume" "notitre" )
if [ "$resume" == "nofile" ]; then
......@@ -1113,8 +1113,8 @@ fi_disk(){ # 08/03/2018
f_prnt
if [ "$fg_nb_disk" -gt 1 ]; then pluriel="s"; else unset pluriel; fi
f_prnt 1 "**types de disque$pluriel** "
f_prnt 2 "ata : $fg_disk_ata" '[ "$fg_disk_ata" ]'
f_prnt 2 "usb : $fg_disk_usb" '[ "$fg_disk_usb" ]'
f_prnt 2 "ata : $fg_disk_ata (y compris externe ata sur usb)" '[ "$fg_disk_ata" ]'
f_prnt 2 "usb : $fg_disk_usb (type clefs usb)" '[ "$fg_disk_usb" ]'
f_prnt 2 "mmc : $fg_disk_mmc" '[ "$fg_disk_mmc" ]'
f_prnt 2 "nvme: $fg_disk_nvme" '[ "$fg_disk_nvme" ]'
f_prnt
......@@ -1127,8 +1127,9 @@ fi_disk(){ # 08/03/2018
f_dspl cmd "$disk_df_i" "$cmd_dfi" "utilisation inoeuds"
# lsblk répertoire disques & partitions
f_dspl cmd "$disk_lsblk" "lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT,UUID" "disque$pluriel & partitions"
# fstab
# fstab & crypttab
f_dspl cmd "$fstab" "grep -Ev '^#|^$' /etc/fstab" "fstab"
f_dspl cmd "$crypttab" "grep -Ev '^#|^$' /etc/crypttab" "crypttab"
# resume
f_dspl cmd "$resume" "grep -Evs '^#|^$' /etc/initramfs-tools/conf.d/resume" "resume"
f_dspl_alrt "$alert_file_resume" "info"
......@@ -1780,7 +1781,7 @@ fi_packagers(){ # 23/11/2017
# shellcheck disable=SC2034
# SC2034 foo appears unused. Verify it or export it.
fi_pkg_apt(){ # 06/03/2018
fi_pkg_apt(){ # 15/03/2018
local dateMaj nb_packages ifile info_update text pluriel
local sources cmt_sources cmd_sources result
local apt_v apt_version apt_prefs cmt_apt_prefs cmd_apt_prefs alert_non_pref
......@@ -1883,7 +1884,9 @@ fi_pkg_apt(){ # 06/03/2018
if [ $(( qte_upgradable[0] )) -gt 1 ]; then pluriel="s"; else unset pluriel; fi
cmt_upgrade="${qte_upgradable[0]} paquet$pluriel à mettre à jour"
[ "${qte_upgradable[0]}" -eq 0 ] && cmt_upgrade=${cmt_upgrade/0 /aucun }
cmd_upgrade="apt list --upgradable"
# /!\ apt list --upgradable ne tient pas compte des paquets figés dans preferences (et holded?) et
# donc résultat > à apt-get upgrade --simulate | grep -c '^Inst '
cmd_upgrade="apt-get upgrade --simulate"
if [ "${qte_upgradable[0]}" -gt 0 ]; then
upgrade=$( grep '^Inst' <<< "$stck_upgd" | sort | awk '{
paquet=$2; paquet=substr(paquet,1,30)
......@@ -1941,8 +1944,10 @@ fi_pkg_apt(){ # 06/03/2018
fi
# clean
clean=$( LC_ALL=C du -chS /var/cache/apt/archives/ 2>/dev/null )
clean=$( f__unit_french "$clean" )
size_cleanH=$( du -chS /var/cache/apt/archives/ 2>/dev/null | grep -i 'total' ) # affichage en human
size_cleanH=${size_cleanH%[[:blank:]]total}
size_cleanH=$( f__unit_french "$size_cleanH" )
qte_clean=$( f__dir -c /var/cache/apt/archives "lock|partial" )
if [ "$qte_clean" -gt 1 ]; then pluriel="s"; else unset pluriel; fi
cmt_clean="taille du cache des paquets"
......@@ -2593,7 +2598,7 @@ fi_system_analyse(){ # 06/03/2018
f_dspl cmd:text "$bootGraph" "$cmd_bootGraph" "$cmt_bootGraph"
}
fi_system_rc(){ # 06/03/2018
fi_system_rc(){ # 12/03/2018
local if_actif iip ip_act
if_actif=$( ip -o link | awk '/state UP/{sub(/:/,"",$2); printf "%s ",$2}' )
......@@ -2603,10 +2608,10 @@ fi_system_rc(){ # 06/03/2018
/inet/ { sub(/\/.*/,"", $4) }
/inet6/ { ip6 = $4; exit }
/inet / { ip4 = $4 }
END { printf "%s %s %s",$2,ip4,ip6 }' )
END { printf "%s %s %s",$2,ip4,ip6 }' )
done
f_prnt code
f_prnt 2 "$( sed -n '1p' <<< "$fg_dmi" )"
f_prnt 2 "$GREEN$( sed -n '1p' <<< "$fg_dmi" )$STD"
f_prnt 2 "$( sed -n '1p' <<< "$fg_cpu" )"
f_prnt 2 "$fe_gpu"
if grep -q 'wl.*' <<< "$ip_act"; then
......@@ -2617,7 +2622,7 @@ fi_system_rc(){ # 06/03/2018
toPrint=$( grep 'Ethernet:' <<< "$fe_cards_reseau" )$'\n'" $(grep -E 'en.*|eth.*' <<< "$ip_act" )"
f_prnt l2 " * ${toPrint/Ethernet: }"
fi
f_prnt
f_prnt
f_prnt l2 "distrib: $fg_distrib (installation: $date_install)"
f_prnt l2 "kernel : $uname"
f_prnt l2 "boot: $mbr, init: $initDaemon $upstart"
......@@ -4604,7 +4609,7 @@ fscript_update(){ # 09/03/2018
rm -fr "$dirTemp"
}
prg_init(){ # 06/03/2018
prg_init(){ # 08/04/2018
PATH='/usr/sbin:/usr/bin:/sbin:/bin'
TERM=xterm
......@@ -4677,7 +4682,7 @@ prg_init(){ # 06/03/2018
f__requis "gawk|mawk>gawk wget ip>iproute2 lspci>pciutils wc>coreutils uptime>procps" || exit 1
# essai évitement awk à la voidlinux (souci avec awk -F ou -F ' | ')
if ! echo 'abc=123' | mawk -F '=|:' {} &>/dev/null; then
if ! echo 'abc=123' | awk -F '=|:' {} &>/dev/null; then
f__error "awk en place va poser problème." "Pour participer au débuggage, vous pouvez contacter:" "$contact"
fi
......
# changelog getInfo
## getInfo 4.4.0 08/04/2018
publi urgente, pour fix archlinux, en plein relifting
* plus: crypttab (fi-disk)
* révision: figet_disk, fi_disk, affichage
* révision: fi_system_rc,
* fix: contournement voidlinux (mawk par erreur)
## getInfo 4.3.0 08/03/2018
* lint: shellcheck
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment