From 80180240ac10e99465dbdabf4e06a7b5cb9ad9b7 Mon Sep 17 00:00:00 2001 From: kyodev Date: Tue, 5 Dec 2017 20:12:07 +0100 Subject: [PATCH] getInfo 2.56.0 --- scripts/getInfo | 53 ++++++++++++++++++++---------------- scripts/getInfo_changelog.md | 6 +++- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/getInfo b/scripts/getInfo index 0a7d7a9..a4e28a8 100755 --- a/scripts/getInfo +++ b/scripts/getInfo @@ -1,6 +1,6 @@ #!/bin/bash -version=2.55.2 +version=2.56.0 date="5/12/2017" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" @@ -713,20 +713,20 @@ fi_bluez(){ # 4/12/2017 fi_conf(){ # 3/12/2017 local confs toScrut=( - /etc/sysctl.conf + '/etc/sysctl.conf' '/etc/sysctl.d/*.conf' '/etc/hostname' # debian - /etc/sysconfig/network # fedora? - /etc/HOSTNAME # suse + '/etc/sysconfig/network' # fedora? + '/etc/HOSTNAME' # suse # /etc/os-release # nouveau standard systemd/freedesktop - /etc/vconsole.conf + '/etc/vconsole.conf' # /etc/locale.conf # voir fi_locale '/etc/tmpfiles.d/*.conf' '/etc/binfmt.d/*.conf' # /etc/machine-id # voir fi-serial '/etc/modules-load.d/*.conf' #modules to load at boot time - /etc/machine-info - /etc/modprobe.d/*.conf # blacklist modules + '/etc/machine-info' + '/etc/modprobe.d/*.conf' # blacklist modules '/etc/systemd/system/*/override.conf' # éditions services ) @@ -736,18 +736,24 @@ fi_conf(){ # 3/12/2017 f_di cmd "$confs" "grep -Ersv '^#|^$' " } -fi_cpu(){ # 1/12/2017 - local cpu_flags text iflag var_temp qte_flags text_flags="" pluriel +fi_cpu(){ # 5/12/2017 + local cpu_flags text iflag qte_flags text_flags="" pluriel local alert_microcode cpu_flags=$( sed -n 's/^flags.*: \(.*\)$/\1/p;' /proc/cpuinfo | sed -n '1p'| \ tr ' ' '\n' | sort | tr '\n' ' ' | xargs ) [ "$CPU_FLAGS" ] || figet_cpu_flags # appel 'base' des tags, obtention $CPU_FLAGS for iflag in $cpu_flags; do - var_temp=$( grep -E "^${iflag^^}[[:blank:]]" <<< $CPU_FLAGS ) - [ "$var_temp" ] && text_flags+=" ‣ $var_temp "$'\n' || text_flags+=" ‣ $iflag\t⟷ \t? "$'\n' + text_flags+="$( + gawk -v motif="$iflag" -F '⟷' ' + BEGIN { IGNORECASE=1; pattern = "^"motif"[[:blank:]]" } + $0 ~ pattern { $1 = motif; exit } + END { if( $1 != motif ) {$1 = motif; $2 = "?"} + printf ("%-15s %s",$1,$2 ) #ligne + }' <<< $CPU_FLAGS + )"$'\n' done - text_flags=${text_flags% [[:cntrl:]]} # suppression espaces et \n final + text_flags=${text_flags%[[:cntrl:]]} # suppression \n final [ "$cpu_flags" ] && qte_flags=$( f__wcv -w "$cpu_flags" flags ) [ "$fg_cpu" ] || figet_cpu if ! figet_ucode ; then # retour fonction en erreur => pas d'installation mais possible @@ -766,7 +772,7 @@ fi_cpu(){ # 1/12/2017 f_di sans "$text_flags" # flags cpu texte } -fi_disk(){ # 1/12/2017 +fi_disk(){ # 5/12/2017 local cmd_dd_temp="" dd_temp="" exclude_df liste_df disk_df disk_df_i cmd_dfi cmd_dfh disk_lsblk fstab local resume idResume idSwap idisk text pluriel local alert_dd_temp alert_file_resume alert_uuidResume @@ -1351,7 +1357,7 @@ fi_log_xorg(){ # 3/12/2017 f_dspl_alrt "$info_logs" "info" } -fi_mem(){ # 1/12/2017 +fi_mem(){ # 5/12/2017 local memoire swappiness text figet_mem "mem" #options possibles mem swap total notitle nocoltitle @@ -1361,8 +1367,8 @@ fi_mem(){ # 1/12/2017 swappiness=$( cat /proc/sys/vm/swappiness 2>/dev/null ) ### f_pr titre2 "mémoire" - f_di cmd "$memoire" "cmd" "free -h" - f_di cmd "$swappiness" "cmd" "cat /proc/sys/vm/swappiness" + f_di cmd "$memoire" "free -h" + f_di cmd "$swappiness" "cat /proc/sys/vm/swappiness" "% \"d'utilisation\" du swap" } # [$1=silent], assigne fe_nb_reseau, fe_cards_reseau @@ -1418,7 +1424,7 @@ fi_net(){ # 1/12/2017 ( matériel ) f_dspl_alrt "$alert_wlx" "alert" } -fi_nm(){ # 1/12/2017 +fi_nm(){ # 5/12/2017 [ $( f__which nmcli ) ] || return 0 local nm_etat cmd_nm_etat cmt_nm_etat nm_conf cmd_nm_conf cmt_nm_conf nm_wifis cmd_nm_wifis cmt_nm_wifis local nm_connected text @@ -1436,9 +1442,9 @@ fi_nm(){ # 1/12/2017 nm_connected=$( LC_ALL=C nmcli -f SSID,ACTIVE,IN-USE device wifi list | gawk '/yes[[:space:]]+\*/ {print $1}' ) ### f_pr titre2 "NetworkManager" - f_di cmd "$nm_etat" "cmd" "$cmd_nm_etat" "$cmt_nm_etat" - f_di cmd "$nm_conf" "cmd" "$cmd_nm_conf" "$cmt_nm_conf" - f_di cmd "$nm_wifis" "cmd" "$cmd_nm_wifis" "$cmt_nm_wifis" + f_di cmd "$nm_etat" "$cmd_nm_etat" "$cmt_nm_etat" + f_di cmd "$nm_conf" "$cmd_nm_conf" "$cmt_nm_conf" + f_di cmd "$nm_wifis" "$cmd_nm_wifis" "$cmt_nm_wifis" } fi_packagers(){ #v2 23/11/2017 @@ -3688,7 +3694,7 @@ fscript_remove(){ # 4/12/2017 } # mise à jour script si dispo, v2, +update spécifique -fscript_update(){ # 4/12/2017 +fscript_update(){ # 6/12/2017 local dirTemp="/tmp/$script-$RANDOM" [ $(type -t fscript_update_special) ] && fscript_update_special # test, si fonction spécifique, appel @@ -3704,7 +3710,8 @@ fscript_update(){ # 4/12/2017 mkdir -p "$dirTemp" wget -q --tries=2 --timeout=15 -O "$dirTemp/$script" "$urlScript" if [ "$?" != "0" ]; then f__wget_test "$urlScript"; fi - if grep -q '#!/bin/bash' "$dirTemp/$script" ; then +# if grep -q '#!/bin/bash' "$dirTemp/$script" ; then + if grep -q '#!/bin/bash' "$dirTemp/$script" && grep -q '^### END CONTROL' "$dirTemp/$script"; then cp -d "$dirTemp/$script" "$scriptInstall" chmod 775 "$scriptInstall" # rwx rwx r-x, proprio fu_user chown "$fu_user:" "$scriptInstall" @@ -3908,7 +3915,7 @@ for j in $options; do ORIGIN='test' prg_1 "$*" echo -n "•" - fi_cpu + fi_disk echo; f_dspl_md "$fileOutput" exit ;; # test -c* | all ) diff --git a/scripts/getInfo_changelog.md b/scripts/getInfo_changelog.md index ff8a7ce..81f4119 100644 --- a/scripts/getInfo_changelog.md +++ b/scripts/getInfo_changelog.md @@ -1,14 +1,18 @@ # changelog getInfo -## 2.55.1 5/12/2017 + + +## 2.56.0 5/12/2017 * révision: syncro fonctions communes * révision: f__requis, f__sudo indépendants de f__which * révision: fscript_cronAnacron, fscript_install, fscript_remove, fscript_update f__log, renommage $fileInstall $fileLogs +* révision tags cpu, gawk, présentation * fix: f__wget_test * fix: fonction manquante +* fix: fi_mem, fi_nm, fix affichage ## 2.54.0 03/12/2017