mirror of https://framagit.org/kyodev/kyopages.git
getInfo 2.37.0
This commit is contained in:
parent
1f6adc779e
commit
4bfe93abf8
367
scripts/getInfo
367
scripts/getInfo
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=2.36.4
|
||||
version=2.37.0
|
||||
date="17/11/2017"
|
||||
projet="simpledeb"
|
||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||
|
@ -1259,85 +1259,55 @@ fi_nm(){ # 13/11/2017
|
|||
unset text
|
||||
}
|
||||
|
||||
# recherche gestion de paquets, assigne $fg_pkg_mgr (raccourci:Titre)
|
||||
fi_packager(){ #v1 13/11/2017
|
||||
|
||||
if type -p dpkg &>/dev/null ; then # apt/dpkg: debian, buntu apt/dpkg
|
||||
fg_pkg_mgr="apt:Apt/dpkg"
|
||||
elif type -p pacman &>/dev/null ; then # pacman: ArchLinux, Chakra Linux, Manjaro, KaOS, Parbola, Antergos, Apricity
|
||||
fg_pkg_mgr="pacman:Pacman"
|
||||
elif type -p pacman-g2 &>/dev/null ; then # pacman-g2: Frugalware
|
||||
fg_pkg_mgr="pacman-g2:Pacman-g2"
|
||||
elif type -p installpkg &>/dev/null || type -p slackpkg &>/dev/null ; then # Slackware, slackpkg gestion automatique paquets
|
||||
fg_pkg_mgr="slackware:Slackware"
|
||||
elif type -p emerge &>/dev/null ; then # portage: Gentoo
|
||||
fg_pkg_mgr="portage:Portage/emerge"
|
||||
elif type -p dnf &>/dev/null || type -p yum &>/dev/null ; then # dnf/rpm: Fedora, RedHat (rpm)
|
||||
fg_pkg_mgr="dnf:Dnf/rpm"
|
||||
elif type -p zypper &>/dev/null ; then # zypper/rpm: Suse, openSuse
|
||||
fg_pkg_mgr="zypper:Zypper/rpm"
|
||||
fi
|
||||
[ "$fg_pkg_mgr" ] && return # fin passe 1, managers les plus importants
|
||||
|
||||
if type -p alps &>/dev/null ; then # AryaLinux
|
||||
fg_pkg_mgr="x:alps"
|
||||
elif type -p eopkg &>/dev/null ; then # Solus Linux
|
||||
fg_pkg_mgr="x:eopkg"
|
||||
elif type -p guix &>/dev/null ; then # GNU Guix
|
||||
fg_pkg_mgr="x:Guix"
|
||||
elif type -p lvu &>/dev/null ; then # Lunar Linux
|
||||
fg_pkg_mgr="x:lvu"
|
||||
elif type -p nix-env &>/dev/null ; then # Nix: NixOs
|
||||
fg_pkg_mgr="x:Nix"
|
||||
elif type -p opkg &>/dev/null ; then # opkg fork ipkg, ipkg (abandonné) sauf sur Syno?
|
||||
fg_pkg_mgr="x:opkg"
|
||||
elif type -p sorcery &>/dev/null ; then # SourceMage
|
||||
fg_pkg_mgr="x:Sorcery"
|
||||
elif type -p tazpkg &>/dev/null ; then # SliTaz
|
||||
fg_pkg_mgr="x:tazpkg"
|
||||
elif type -p tce-status &>/dev/null ; then # TinyCoreLinux
|
||||
fg_pkg_mgr="x:TinyCoreExtensions"
|
||||
elif type -p xbps-query &>/dev/null ; then # VoidLinux
|
||||
fg_pkg_mgr="x:VoidLinux"
|
||||
else
|
||||
fg_pkg_mgr="y:Inconnue"
|
||||
fi
|
||||
}
|
||||
|
||||
# aiguillage selon les gestionnaires de paquets
|
||||
fi_pkg__ctl(){ #v1 16/11/2017
|
||||
fi_packager(){ #v2 17/11/2017
|
||||
local alert_pkg_todo="ce gestionnaire de paquets n'est pas maîtrisé par manque d'expertise \n"
|
||||
alert_pkg_todo+="vous êtes donc bienvenus à contribuer dans ce domaine: \n"
|
||||
alert_pkg_todo+="https://framagit.org/kyodev/kyopages/blob/master/scripts/CONTRIB.md#getinfo \n\n"
|
||||
alert_pkg_todo+="merci de tester attentivement pour surveiller les spécificités éventuelles de votre "
|
||||
alert_pkg_todo+="distibution"
|
||||
[ "$fg_pkg_mgr" ] || fi_packager
|
||||
###
|
||||
if [[ ${fg_pkg_mgr%:*} == "apt" ]]; then # debian
|
||||
fi_pkg_apt
|
||||
unset alert_pkg_todo # modèle, alert_pkg_todo pas implanté dans fi_pkg_apt
|
||||
elif [[ ${fg_pkg_mgr%:*} == "pacman" ]]; then # Archlinux
|
||||
fi_pkg_pacman
|
||||
elif [[ ${fg_pkg_mgr%:*} == "pacman-g2" ]]; then # Frugalware
|
||||
fi_pkg_pacmanG2
|
||||
elif [[ ${fg_pkg_mgr%:*} == "slackware" ]]; then # slackware
|
||||
fi_pkg_slack
|
||||
elif [[ ${fg_pkg_mgr%:*} == "portage" ]]; then # Gentoo
|
||||
fi_pkg_emerge
|
||||
elif [[ ${fg_pkg_mgr%:*} == "dnf" ]]; then # Fedora
|
||||
fi_pkg_dnf
|
||||
elif [[ ${fg_pkg_mgr%:*} == "zypper" ]]; then # Suse
|
||||
fi_pkg_zypper
|
||||
elif [[ ${fg_pkg_mgr%:*} == "x" || ${fg_pkg_mgr%:*} == "y" ]]; then # suppression à la fin de fg_pkg_mgr, champs 2 ifs ':'
|
||||
fi_pkg_x # gestion de paquets peu connue ou inconnue
|
||||
alert_pkg_todo+="https://framagit.org/kyodev/kyopages/blob/master/scripts/CONTRIB.md#getinfo"
|
||||
if type -p dpkg &>/dev/null ; then # debian, buntu apt/dpkg
|
||||
unset alert_pkg_todo # modèle, alert_pkg_todo pas implanté dans fi_pkg_apt
|
||||
fi_pkg_apt "apt:Apt/dpkg"
|
||||
elif type -p dnf &>/dev/null || type -p yum &>/dev/null ; then # Fedora, RedHat (rpm)
|
||||
fi_pkg_x "dnf:Dnf/rpm"
|
||||
elif type -p pacman &>/dev/null ; then # ArchLinux, Chakra Linux, Manjaro, KaOS, Parbola, Antergos, Apricity
|
||||
fi_pkg_x "pacman:Pacman"
|
||||
elif type -p pacman-g2 &>/dev/null ; then # Frugalware
|
||||
fi_pkg_x "pacman-g2:Pacman-g2"
|
||||
elif type -p emerge &>/dev/null ; then # Gentoo
|
||||
fi_pkg_x "portage:Portage/emerge"
|
||||
elif type -p installpkg &>/dev/null || type -p slackpkg &>/dev/null ; then # Slackware, slackpkg gestion automatique paquets
|
||||
fi_pkg_x "slackware:Slackware"
|
||||
elif type -p zypper &>/dev/null ; then # Suse, openSuse
|
||||
fi_pkg_x "zypper:Zypper/rpm"
|
||||
elif type -p alps &>/dev/null ; then # AryaLinux
|
||||
fi_pkg_x "x:alps"
|
||||
elif type -p eopkg &>/dev/null ; then # Solus Linux
|
||||
fi_pkg_x "x:eopkg"
|
||||
elif type -p guix &>/dev/null ; then # GNU Guix
|
||||
fi_pkg_x "x:Guix"
|
||||
elif type -p lvu &>/dev/null ; then # Lunar Linux
|
||||
fi_pkg_x "x:lvu"
|
||||
elif type -p nix-env &>/dev/null ; then # Nix: NixOs
|
||||
fi_pkg_x "x:Nix"
|
||||
elif type -p opkg &>/dev/null ; then # opkg fork ipkg, ipkg (abandonné) sauf sur Syno?
|
||||
fi_pkg_x "x:opkg"
|
||||
elif type -p sorcery &>/dev/null ; then # SourceMage
|
||||
fi_pkg_x "x:Sorcery"
|
||||
elif type -p tazpkg &>/dev/null ; then # SliTaz
|
||||
fi_pkg_x "x:tazpkg"
|
||||
elif type -p tce-status &>/dev/null ; then # TinyCoreLinux
|
||||
fi_pkg_x "x:TinyCoreExtensions"
|
||||
elif type -p xbps-query &>/dev/null ; then # VoidLinux
|
||||
fi_pkg_x "x:VoidLinux"
|
||||
else
|
||||
fi_pkg_x "x:Inconnue"
|
||||
fi
|
||||
}
|
||||
|
||||
fi_pkg_apt(){ #v3 17/11/2017
|
||||
local sources ifile dateMaj nb_packages stock_upgd upgradable_qte upgrade upgrade_comment
|
||||
local notUpgraded notUpgraded_comment toRemove_qte toRemove toRemove_comment
|
||||
local non_ii non_ii_qte non_ii_comment etat ligne stock_etat deborphan deborphan_qte deborphan_comment
|
||||
local holded holded_qte holded_comment text pluriel
|
||||
local sources ifile dateMaj nb_packages stock_upgd qte_upgradable upgrade comment_upgrade
|
||||
local notUpgraded comment_notUpgraded toRemove qte_toRemove comment_toRemove
|
||||
local non_ii qte_non_ii comment_non_ii etat ligne stock_etat deborphan qte_deborphan comment_deborphan
|
||||
local holded qte_holded comment_holded text pluriel
|
||||
local alert_non_list alert_httpredir alert_upgrade alert_full_upgrade alert_remove alert_non_ii
|
||||
local alert_deborphan
|
||||
# sources & divers
|
||||
|
@ -1356,12 +1326,12 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
printf "◇"
|
||||
stock_upgd=$( LC_ALL=C apt-get upgrade --simulate )
|
||||
# $1 upgraded, $6 to remove and $10 not upgraded
|
||||
upgradable_qte=($(gawk '/ newly installed/{print $1" "$6" "$10}' <<< $stock_upgd)) # tableau
|
||||
# => upgradable_qte [0]=upgraded, [1]=notUpgraded
|
||||
[ "${upgradable_qte[0]}" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
upgrade_comment="${upgradable_qte[0]} paquet"$pluriel" à mettre à jour"
|
||||
[ "${upgradable_qte[0]}" -eq 0 ] && upgrade_comment=${upgrade_comment/0 /aucun }
|
||||
if [ "${upgradable_qte[0]}" -gt 0 ]; then # upgraded
|
||||
qte_upgradable=($(gawk '/ newly installed/{print $1" "$6" "$10}' <<< $stock_upgd)) # tableau
|
||||
# => qte_upgradable [0]=upgraded, [1]=notUpgraded
|
||||
[ "${qte_upgradable[0]}" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_upgrade="${qte_upgradable[0]} paquet"$pluriel" à mettre à jour"
|
||||
[ "${qte_upgradable[0]}" -eq 0 ] && comment_upgrade=${comment_upgrade/0 /aucun }
|
||||
if [ "${qte_upgradable[0]}" -gt 0 ]; then # upgraded
|
||||
# upgrade
|
||||
upgrade=$( grep '^Inst' <<< "$stock_upgd" )
|
||||
upgrade=$( sort <<< $upgrade )
|
||||
|
@ -1372,15 +1342,15 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
alert_upgrade+='`apt upgrade` '
|
||||
fi
|
||||
# full-upgrade
|
||||
if [ "${upgradable_qte[1]}" -gt 0 ]; then
|
||||
if [ "${qte_upgradable[1]}" -gt 0 ]; then
|
||||
notUpgraded=${stock_upgd%The following packages wil be upgraded*} # suppression fin
|
||||
notUpgraded=${notUpgraded#*The following packages have been kept back:} # suppression début
|
||||
notUpgraded=$( sed '/newly/d' <<< "$notUpgraded" ) # suppression ligne état
|
||||
notUpgraded=$( sort <<< $notUpgraded )
|
||||
notUpgraded=$( tr '\n' ' ' <<< $notUpgraded ) # remplacement newline
|
||||
notUpgraded=${notUpgraded// / } # suppression espace double
|
||||
[ "${upgradable_qte[1]}" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
notUpgraded_comment="${upgradable_qte[1]} paquet"$pluriel" nécessitant une mise à jour profonde)"
|
||||
[ "${qte_upgradable[1]}" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_notUpgraded="${qte_upgradable[1]} paquet"$pluriel" nécessitant une mise à jour profonde)"
|
||||
alert_full_upgrade="les paquets peuvent être mis à jour avec avec: \n"
|
||||
alert_full_upgrade+='`apt full-upgrade` '
|
||||
fi
|
||||
|
@ -1388,12 +1358,12 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
# autoremove
|
||||
toRemove=$( LC_ALL=C apt-get autoremove --simulate | grep -E 'Remv | newly installed' )
|
||||
toRemove=$( sort <<< $toRemove )
|
||||
toRemove_qte=$( gawk '/ newly installed/{printf $6}' <<< $toRemove )
|
||||
qte_toRemove=$( gawk '/ newly installed/{printf $6}' <<< $toRemove )
|
||||
toRemove=$( sed '/newly/d' <<< "$toRemove" ) # suppression ligne état
|
||||
[ "$toRemove_qte" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
toRemove_comment="$toRemove_qte paquet"$pluriel" non nécessaire"$pluriel
|
||||
[ "$toRemove_qte" -eq 0 ] && toRemove_comment=${toRemove_comment/0 /aucun }
|
||||
if [ "$toRemove_qte" -gt 0 ]; then
|
||||
[ "$qte_toRemove" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_toRemove="$qte_toRemove paquet"$pluriel" non nécessaire"$pluriel
|
||||
[ "$qte_toRemove" -eq 0 ] && comment_toRemove=${comment_toRemove/0 /aucun }
|
||||
if [ "$qte_toRemove" -gt 0 ]; then
|
||||
toRemove=$( sed -E '/^Remv/!d; s/\[.*\]//g; s/Remv //' <<< $toRemove | tr '\n' ' ' )
|
||||
toRemove=${toRemove// / }
|
||||
alert_remove="les paquets peuvent être supprimés avec: \n"
|
||||
|
@ -1406,11 +1376,11 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
# paquet non ^ii
|
||||
non_ii=$( LC_ALL=C dpkg -l | gawk 'FNR>5 && ! /^i/ {
|
||||
printf "%-3s %-20s %-12s",$1,$2,$3; $1=$2=$3=$4=""; printf "%s \n",$0}' )
|
||||
non_ii_qte=$( f__wcv -l "$non_ii" )
|
||||
[ "$non_ii_qte" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
non_ii_comment="$non_ii_qte paquet"$pluriel" dans un état non standard"
|
||||
[ "$non_ii_qte" -eq 0 ] && non_ii_comment=${non_ii_comment/0 /aucun }
|
||||
if [ "$non_ii_qte" -gt 0 ]; then
|
||||
qte_non_ii=$( f__wcv -l "$non_ii" )
|
||||
[ "$qte_non_ii" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_non_ii="$qte_non_ii paquet"$pluriel" dans un état non standard"
|
||||
[ "$qte_non_ii" -eq 0 ] && comment_non_ii=${comment_non_ii/0 /aucun }
|
||||
if [ "$qte_non_ii" -gt 0 ]; then
|
||||
# extraction différents états constatés
|
||||
while read etat ligne ; do
|
||||
stock_etat+="$etat"$'\n'
|
||||
|
@ -1443,24 +1413,24 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
fi
|
||||
if [ "$( f__cmd_exist deborphan )" ]; then
|
||||
deborphan=$( deborphan -P )
|
||||
deborphan_qte=$( f__wcv "-l" "$deborphan" )
|
||||
[ "$deborphan_qte" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
deborphan_comment="$deborphan_qte bibliothèque"$pluriel" orpheline"$pluriel
|
||||
[ "$deborphan_qte" -eq 0 ] && deborphan_comment=${deborphan_comment/0 /aucune }
|
||||
if [ "$deborphan_qte" -gt 0 ]; then
|
||||
qte_deborphan=$( f__wcv "-l" "$deborphan" )
|
||||
[ "$qte_deborphan" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_deborphan="$qte_deborphan bibliothèque"$pluriel" orpheline"$pluriel
|
||||
[ "$qte_deborphan" -eq 0 ] && comment_deborphan=${comment_deborphan/0 /aucune }
|
||||
if [ "$qte_deborphan" -gt 0 ]; then
|
||||
alert_deborphan="bibliothèque"$pluriel" orpheline"$pluriel", suppression possible: \n"
|
||||
alert_deborphan+='`apt remove \$(deborphan)` \n'
|
||||
alert_deborphan+="recherche légère, mais vérifier avant de valider la suppression"
|
||||
fi
|
||||
fi
|
||||
holded=$( apt-mark showhold )
|
||||
holded_qte=$( f__wcv "-l" "$holded" )
|
||||
qte_holded=$( f__wcv "-l" "$holded" )
|
||||
[ "$holded" ] && holded=$( sort <<< $holded | tr '\n' ' ' )
|
||||
[ "$holded_qte" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
holded_comment="$holded_qte paquet"$pluriel" épinglé"$pluriel
|
||||
[ "$holded_qte" -eq 0 ] && holded_comment=${holded_comment/0 /aucun }
|
||||
[ "$qte_holded" -gt 1 ] && pluriel="s" || unset pluriel
|
||||
comment_holded="$qte_holded paquet"$pluriel" épinglé"$pluriel
|
||||
[ "$qte_holded" -eq 0 ] && comment_holded=${comment_holded/0 /aucun }
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text="## gestion de paquets **${1#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n"
|
||||
text+="* dernière mise à jour apt: **$dateMaj** \n"
|
||||
text+="\n"
|
||||
|
@ -1468,130 +1438,105 @@ fi_pkg_apt(){ #v3 17/11/2017
|
|||
"dépôts"
|
||||
f_dspl_alert "alert_non_list" "info"
|
||||
f_dspl_alert "alert_httpredir" "info"
|
||||
f_display "upgrade" "cmd:vide" "apt list --upgradable" "$upgrade_comment"
|
||||
f_display "upgrade" "cmd:vide" "apt list --upgradable" "$comment_upgrade"
|
||||
f_dspl_alert "alert_upgrade" "info"
|
||||
f_display "notUpgraded" "cmd" "apt list --upgradable" "$notUpgraded_comment"
|
||||
f_display "notUpgraded" "cmd" "apt list --upgradable" "$comment_notUpgraded"
|
||||
f_dspl_alert "alert_full_upgrade" "info"
|
||||
f_display "toRemove" "cmd:vide" "apt autoremove --simulate" "$toRemove_comment"
|
||||
f_display "toRemove" "cmd:vide" "apt autoremove --simulate" "$comment_toRemove"
|
||||
f_dspl_alert "alert_remove" "info"
|
||||
#dpkg -l | gawk '! /^ii/ {print $0}'
|
||||
f_display "non_ii" "cmd:vide" "dpkg -l | grep -v '^ii'" "$non_ii_comment"
|
||||
f_display "non_ii" "cmd:vide" "dpkg -l | grep -v '^ii'" "$comment_non_ii"
|
||||
f_dspl_alert "alert_non_ii" "info"
|
||||
[ "$( f__cmd_exist deborphan )" ] && f_display "deborphan" "cmd:vide" "deborphan -P" \
|
||||
"$deborphan_comment"
|
||||
"$comment_deborphan"
|
||||
[ "$( f__cmd_exist deborphan )" ] && f_dspl_alert "alert_deborphan" "info"
|
||||
f_display "holded" "cmd:vide" "apt-mark showhold" "$holded_comment"
|
||||
f_display "holded" "cmd:vide" "apt-mark showhold" "$comment_holded"
|
||||
printf "$text\n" >> "$fileOutput"
|
||||
unset text
|
||||
}
|
||||
|
||||
fi_pkg_dnf(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( dnf list installed &>/dev/null || rpm -qa &>/dev/null )
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/yum.repos.d/*.repo" )
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/pacman.conf /etc/pacman.d/*"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_emerge(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( emerge -ep world &>/dev/null )
|
||||
# Sabayon: + Entropy ?
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/portage/repos.conf /etc/portage/repos.conf/*" )
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/portage/repos.conf /etc/portage/repos.conf/*"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_pacman(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( pacman -Q &>/dev/null )
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/pacman.conf /etc/pacman.d/*" )
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_pacmanG2(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( pacman-g2 -Q &>/dev/null )
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/pacman.conf /etc/pacman.d/*" ) # coup de bluff
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/pacman.conf /etc/pacman.d/*"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_slack(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( ls -1 /var/log/packages &>/dev/null )
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/slackpkg/mirrors" )
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}*** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_zypper(){ # 13/11/2017
|
||||
local nb_packages sources
|
||||
nb_packages=$( zypper search --installed-only &>/dev/null || rpm -qa &>/dev/null )
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
sources=$( f_grep_file "/etc/zypp/repos.d/*.repo" )
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
f_display "sources" "cmd" "grep -Ersv '^#|^$' /etc/zypp/repos.d/*.repo"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
}
|
||||
|
||||
fi_pkg_x(){ # 13/11/2017
|
||||
local nb_packages sources cmd_sources
|
||||
if [[ ${fg_pkg_mgr#*:} == "alps" ]]; then # AryaLinux
|
||||
fi_pkg_x(){ #v2 17/11/2017
|
||||
local nb_packages cmd_nbPackages sources cmd_sources holded cmd_holded
|
||||
if [[ ${1%:*} == "dnf" ]]; then # Fedora, RedHat (rpm)
|
||||
# http://dnf.readthedocs.io/en/latest/command_ref.html
|
||||
# http://landoflinux.com/linux_dnf_command_examples.html
|
||||
nb_packages=$( LC_ALL=C dnf list installed 2>/dev/null ) # nb_packages=$( f__wcv -l "$( rpm -qa 2>/dev/null )")
|
||||
nb_packages=${nb_packages#*Installed Packages} # suppression début variable jusqu'à Installed...
|
||||
cmd_nbPackages="dnf list installed"
|
||||
sources=$( f_grep_file "/etc/yum.repos.d/*.repo" )
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/yum.repos.d/*.repo"
|
||||
elif [[ ${1%:*} == "pacman" ]]; then # ArchLinux
|
||||
nb_packages=$( pacman -Q &>/dev/null ) # pas d'exemple de sortie trouvé
|
||||
cmd_nbPackages="pacman -Q"
|
||||
sources=$( f_grep_file "/etc/pacman.conf /etc/pacman.d/*" )
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/pacman.conf /etc/pacman.d/*"
|
||||
elif [[ ${1%:*} == "pacman-g2" ]]; then # Frugalware
|
||||
nb_packages=$( pacman-g2 -Q &>/dev/null ) # pas d'exemple de sortie trouvé
|
||||
cmd_nbPackages="pacman-g2 -Q"
|
||||
sources=$( f_grep_file "/etc/pacman.conf /etc/pacman.d/*" ) # coup de bluff
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/pacman.conf /etc/pacman.d/*"
|
||||
elif [[ ${1%:*} == "portage" ]]; then # Gentoo # Sabayon: + Entropy ?
|
||||
nb_packages=$( emerge -ep world &>/dev/null ) # pas d'exemple de sortie trouvé
|
||||
cmd_nbPackages="emerge -ep world"
|
||||
sources=$( f_grep_file "/etc/portage/repos.conf /etc/portage/repos.conf/*" )
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/portage/repos.conf /etc/portage/repos.conf/*"
|
||||
elif [[ ${1%:*} == "slackware" ]]; then # Slackware
|
||||
nb_packages=$( ls -1 /var/log/packages 2>/dev/null )
|
||||
cmd_nbPackages="wc -l <<< \$(ls -1 /var/log/packages)"
|
||||
sources=$( f_grep_file "/etc/slackpkg/mirrors" )
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/slackpkg/mirrors"
|
||||
elif [[ ${1%:*} == "zypper" ]]; then # Suse, openSuse
|
||||
nb_packages=$( zypper search --installed-only 2>/dev/null | grep '^i' ) # # nb_packages=$( f__wcv -l "$( rpm -qa 2>/dev/null )")
|
||||
cmd_nbPackages="zypper search --installed-only"
|
||||
sources=$( f_grep_file "/etc/zypp/repos.d/*.repo" )
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/zypp/repos.d/*.repo"
|
||||
holded=$( zypper locks 2>/dev/null )
|
||||
cmd_holded="zypper locks"
|
||||
elif [[ ${1#*:} == "alps" ]]; then # AryaLinux
|
||||
nb_packages=$( alps showinstalled &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "eopkg" ]]; then # Solus Linux
|
||||
nb_packages=$( ls -1 /var/lib/eopkg/package &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "Guix" ]]; then # Gnu Guix
|
||||
nb_packages=$( ls -1 /gnu/store/*/ &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "lvu" ]]; then # LunarLinux
|
||||
nb_packages=$( lvu installed &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "Nix" ]]; then # NixOs
|
||||
nb_packages=$( ls -d -1 /nix/store/*/ &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "opkg" ]]; then # opkg fork ipkg, ipkg (abandonné) sauf sur Syno?
|
||||
nb_packages=$( opkg list-installed &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "Sorcery" ]]; then # SourceMage (sorcerer)
|
||||
nb_packages=$( gaze installed &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "tazpkg" ]]; then # SliTaz
|
||||
nb_packages=$( tazpkg list &>/dev/null )
|
||||
elif [[ ${fg_pkg_mgr#*:} == "TinyCoreExtensions" ]]; then # TinyCoreLinux
|
||||
nb_packages=$( tce-status -i &>/dev/null )
|
||||
cmd_nbPackages="alps showinstalled"
|
||||
elif [[ ${1#*:} == "eopkg" ]]; then # Solus Linux
|
||||
nb_packages=$( ls -1 /var/lib/eopkg/package 2>/dev/null )
|
||||
nb_packages=$( f__wcv -l "$nb_packages")
|
||||
cmd_nbPackages="wc -l <<< \$(ls -1 /var/lib/eopkg/package)"
|
||||
elif [[ ${1#*:} == "Guix" ]]; then # Gnu Guix
|
||||
nb_packages=$( ls -1 /gnu/store/*/ 2>/dev/null )
|
||||
cmd_nbPackages="wc -l <<< \$(ls -1 /gnu/store/*/)"
|
||||
elif [[ ${1#*:} == "lvu" ]]; then # LunarLinux
|
||||
nb_packages=$( lvu installed 2>/dev/null )
|
||||
cmd_nbPackages="lvu installed"
|
||||
elif [[ ${1#*:} == "Nix" ]]; then # NixOs
|
||||
nb_packages=$( ls -d -1 /nix/store/*/ 2>/dev/null )
|
||||
cmd_nbPackages="wc -l <<< \$(ls -1 /nix/store/*/)"
|
||||
elif [[ ${1#*:} == "opkg" ]]; then # opkg fork ipkg, ipkg (abandonné) sauf sur Syno?
|
||||
nb_packages=$( opkg list-installed 2>/dev/null )
|
||||
cmd_nbPackages="opkg list-installed"
|
||||
elif [[ ${1#*:} == "Sorcery" ]]; then # SourceMage (sorcerer)
|
||||
nb_packages=$( gaze installed 2>/dev/null )
|
||||
cmd_nbPackages="gaze installed"
|
||||
elif [[ ${1#*:} == "tazpkg" ]]; then # SliTaz
|
||||
nb_packages=$( tazpkg list 2>/dev/null )
|
||||
cmd_nbPackages="tazpkg list"
|
||||
elif [[ ${1#*:} == "TinyCoreExtensions" ]]; then # TinyCoreLinux
|
||||
nb_packages=$( tce-status -i 2>/dev/null )
|
||||
cmd_nbPackages="tce-status -i"
|
||||
sources=$( f_grep_file "/opt/tcemirror" )
|
||||
cmd_sources="/opt/tcemirror"
|
||||
elif [[ ${fg_pkg_mgr#*:} == "VoidLinux" ]]; then # VoidLinux
|
||||
nb_packages=$( xbps-query -l &>/dev/null )
|
||||
elif [[ ${1#*:} == "VoidLinux" ]]; then # VoidLinux
|
||||
nb_packages=$( xbps-query -l 2>/dev/null )
|
||||
cmd_nbPackages="xbps-query"
|
||||
sources=$( f_grep_file "/etc/xbps.d/* /usr/share/xbps.d/*" )
|
||||
cmd_sources="/etc/xbps.d/* /usr/share/xbps.d/*"
|
||||
cmd_sources="grep -Ersv '^#|^$' /etc/xbps.d/* /usr/share/xbps.d/*"
|
||||
fi
|
||||
[ "$nb_packages" ] && nb_packages=$( echo "$nb_packages" | wc -l ) || nb_packages="n/a"
|
||||
[[ ${fg_pkg_mgr%:*} == "y" ]] && unset nb_packages # totalement inconnu
|
||||
nb_packages=$( f__wcv -l "$nb_packages")
|
||||
[[ -z "$nb_packages" || "$nb_packages" -le 5 ]] && nb_packages="n/a"
|
||||
[[ ${1#*:} == "Inconnue" ]] && unset nb_packages # totalement inconnu
|
||||
###
|
||||
text="## gestion de paquets **${fg_pkg_mgr#*:}** \n\n"
|
||||
[ "$nb_packages" ] && text+="* nombre de paquets installés: **$nb_packages** \n\n"
|
||||
text="## gestion de paquets **${1#*:}** \n\n"
|
||||
f_display "nb_packages" "cmd:text" "$cmd_nbPackages" "nombre de paquets installés"
|
||||
f_display "sources" "cmd" "$cmd_sources" "sources"
|
||||
f_display "alert_pkg_todo" "var" "" "aide requise"
|
||||
f_display "holded" "cmd" "$cmd_holded" "paquets verrouillés"
|
||||
f_display "alert_pkg_todo" "var" "" "aide souhaitée"
|
||||
}
|
||||
|
||||
fi_reseau(){ # 13/11/2017
|
||||
|
@ -3114,7 +3059,7 @@ prg_2(){ # traitements principaux
|
|||
echo -n " "
|
||||
if [[ "$1" == all || "$1" =~ c ]]; then #configuration #debian, packages -cc
|
||||
echo -e "# ▷ Configuration \n\n" >> "$fileOutput"
|
||||
for i in fi_locale fi_vrms fi_pkg__ctl ; do
|
||||
for i in fi_locale fi_vrms fi_packager ; do
|
||||
echo -n "•"
|
||||
$i
|
||||
done
|
||||
|
@ -3261,7 +3206,7 @@ for j in $options; do
|
|||
case $j in
|
||||
-t | --test )
|
||||
prg_1 "$*"
|
||||
fi_pkg_apt
|
||||
fi_packager
|
||||
exit ;; # test
|
||||
-c* | all )
|
||||
[ "$j" == "-c" ] && exec $0 "menu"
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
* ! f__requis, fscript_install, f__scandir
|
||||
|
||||
|
||||
## 2.37.0 17/11/2017
|
||||
|
||||
* révision complète: fi_packager fi_pkg_x
|
||||
* fusion pkg_ctl & fi_packager
|
||||
|
||||
## 2.36.4 17/11/2017
|
||||
|
||||
|
|
Loading…
Reference in New Issue