Skip to content
Snippets Groups Projects
Commit 92a8b240 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

packages2install: put filtered view into function

parent 0b709ee7
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,48 @@ function checkYum(){ ...@@ -180,7 +180,48 @@ function checkYum(){
echo echo
} }
# ----------------------------------------------------------------------
# show grouped packages by category
# OOPS: uses global vars :-/
function showFilteredPackages(){
# filtered package view
if [ ! -z "$pkgsum" ]; then
typeset -i iTotal=$( echo "$pkgsum" | wc -l )
typeset -i iFound=0
# show filtered view
for filterfile in $( ls -1 $0-data/*txt | sort )
do
filtername=$( echo $filterfile | rev | cut -f 1 -d "/" | rev | sed "s#.txt\$##g" | sed "s#^[0-9]*_##g" )
filterdata=$( cat ${filterfile} | grep "^[a-zA-Z]" )
out=$( echo "$pkgsum" | _filterPkg "${filterdata}" )
typeset -i iCount=$( echo "$out" | grep "." | wc -l )
test $iCount -ne 0 && (
echo --- $( echo "$filtername" | sed "s#MYfilter##g" ): $iCount
echo "$out" | nl; echo
)
iFound=$iFound+$iCount
done
# show count of non matching packages
typeset -i iOther=$iTotal-$iFound
if [ $iFound -eq 0 ]; then
echo "No package matched a group filter."
else
echo "Other packages: $iOther"
fi
# total packages
echo Total packages to install: $iTotal
fi
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# main # main
...@@ -215,41 +256,7 @@ echo "$pkgstatus" ...@@ -215,41 +256,7 @@ echo "$pkgstatus"
echo echo
showAutoupdate showAutoupdate
echo echo
showFilteredPackages
# filtered package view
if [ ! -z "$pkgsum" ]; then
typeset -i iTotal=$( echo "$pkgsum" | wc -l )
typeset -i iFound=0
# show filtered view
for filterfile in $( ls -1 $0-data/*txt | sort )
do
filtername=$( echo $filterfile | rev | cut -f 1 -d "/" | rev | sed "s#.txt\$##g" | sed "s#^[0-9]*_##g" )
filterdata=$( cat ${filterfile} | grep "^[a-zA-Z]" )
out=$( echo "$pkgsum" | _filterPkg "${filterdata}" )
typeset -i iCount=$( echo "$out" | grep "." | wc -l )
test $iCount -ne 0 && (
echo --- $( echo "$filtername" | sed "s#MYfilter##g" ): $iCount
echo "$out" | nl; echo
)
iFound=$iFound+$iCount
done
# show count of non matching packages
typeset -i iOther=$iTotal-$iFound
if [ $iFound -eq 0 ]; then
echo "No package matched a group filter."
else
echo "Other packages: $iOther"
fi
# total packages
echo Total packages to install: $iTotal
fi
ph.exit ph.exit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment