From b6d936095ddfd0374ed501583d7c2755d5e69a6f Mon Sep 17 00:00:00 2001 From: David P Date: Thu, 6 Sep 2018 00:48:26 -0300 Subject: find-deprecated-pkgs: advise when there are no pkgs to remove Signed-off-by: David P --- find-deprecated-pkgs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'find-deprecated-pkgs') diff --git a/find-deprecated-pkgs b/find-deprecated-pkgs index 246369e..e2bd276 100755 --- a/find-deprecated-pkgs +++ b/find-deprecated-pkgs @@ -128,7 +128,6 @@ submsg() { "$(tput bold;tput setaf 4)" \ "$(tput sgr0)" \ "$1" - out=x } get_libre_pkgs() { @@ -150,6 +149,10 @@ get_libre_pkgs() { fi } +add(){ + list=$(( $list + 1 )) +} + compare_pkgs(){ # $1 is the pkgname and replacement (used when checking Arch pkgs) # $2 is the packages file list @@ -206,8 +209,10 @@ compare_pkgs(){ # Arch if [[ ${is_not_for[@]} = "x86_64 i686 armv7h" ]]; then submsg "$package was not found" + add elif [[ ${to_be_removed[@]} = "x86_64 i686 armv7h" ]]; then submsg "$package was not found, but we've [libre] replacements which should be removed" + add elif ! [[ ${is_not_for[@]} = "" ]] || ! [[ ${to_be_removed[@]} = "" ]]; then for arch in ${to_be_removed[@]}; do # If the replacement is available for the three arch'es supported @@ -217,6 +222,7 @@ compare_pkgs(){ done if ! [[ ${arches[*]} = "x86_64 i686 armv7h" ]]; then submsg "$package ($arch) was not found, but we've a [libre] replacement which should be removed" + add fi unset arches done @@ -225,9 +231,11 @@ compare_pkgs(){ # Parabola if [[ ${isnt_for[@]} = "x86_64 i686 armv7h" ]]; then submsg "$package was not found" + add elif ! [[ ${isnt_for[@]} = "" ]]; then for arch in ${to_be_deleted[@]}; do submsg "$package ($arch) was not found, but we've $replacement as replacement and should be removed" + add done fi @@ -249,9 +257,7 @@ check(){ for p in $pkgs; do compare_pkgs $p $parabola_pkgs done - rm -f $parabola_pkgs $libre_pkgs - if [[ $out = x ]]; then submsg 'The blacklist matches all packages correctly'; fi - msg 'done' + rm -f $parabola_pkgs ;; arch) msg 'Comparing blacklists with Arch packages ...' pkgs=$(for bl in $blacklists; do grep -v ^# $bl | awk '{print $1}'; done) @@ -259,12 +265,14 @@ check(){ compare_pkgs $p $arch_pkgs done rm -f $arch_pkgs $libre_pkgs - if [[ $out = x ]]; then submsg 'The blacklist matches all packages correctly'; fi - msg 'done' ;; *) err "$1 is not a valid argument" ;; esac + if ! [[ $list -gt 0 ]]; then + submsg 'No packages to show' + fi + msg 'done' } if [[ $@ = "" ]]; then -- cgit v1.2.2