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

packages2install: show non matching packages in section other

parent 6f4cd078
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# 2021-05-11 v1.4 <axel.hahn@iml.unibe.ch> added centos8 support # 2021-05-11 v1.4 <axel.hahn@iml.unibe.ch> added centos8 support
# 2021-08-20 v1.5 <martin.gasser@iml.unibe.ch> bug fixing - missing sudo in yum command # 2021-08-20 v1.5 <martin.gasser@iml.unibe.ch> bug fixing - missing sudo in yum command
# 2021-12-16 v1.6 <axel.hahn@iml.unibe.ch> show filtered overview # 2021-12-16 v1.6 <axel.hahn@iml.unibe.ch> show filtered overview
# 2021-12-17 v1.7 <axel.hahn@iml.unibe.ch> show non matching packages in section "other"
# ====================================================================== # ======================================================================
...@@ -60,10 +61,12 @@ function _exec(){ ...@@ -60,10 +61,12 @@ function _exec(){
# filter is a param with spaced keywords that will be transformed # filter is a param with spaced keywords that will be transformed
# to a regex # to a regex
# param1 text if filter keywords (seperated by space) # param1 text if filter keywords (seperated by space)
# param2 text additional grep params; "-v" to invert filtering
function _filterPkg(){ function _filterPkg(){
local _filter=$( echo $1 | tr " " "|" ) local _filter=$( echo $1 | tr " " "|" )
local _moreparams=$2
grep -E "^($_filter)" grep $_moreparams -E "^($_filter)"
} }
# autodetect a package manager using which with # autodetect a package manager using which with
...@@ -78,7 +81,9 @@ function detectPkgManager(){ ...@@ -78,7 +81,9 @@ function detectPkgManager(){
} }
# Debian like Linux # Debian like Linux
# - Debian 10
# - Debian 11 # - Debian 11
# - Ubuntu
function pkgApt(){ function pkgApt(){
local sum=$( _exec "sudo apt-get -u upgrade --assume-no" ) local sum=$( _exec "sudo apt-get -u upgrade --assume-no" )
...@@ -190,12 +195,14 @@ function showFilteredPackages(){ ...@@ -190,12 +195,14 @@ function showFilteredPackages(){
if [ ! -z "$pkgsum" ]; then if [ ! -z "$pkgsum" ]; then
typeset -i iTotal=$( echo "$pkgsum" | wc -l ) typeset -i iTotal=$( echo "$pkgsum" | wc -l )
typeset -i iFound=0 typeset -i iFound=0
filterAll=""
# show filtered view # show filtered view
for filterfile in $( ls -1 $0-data/*txt | sort ) for filterfile in $( ls -1 $0-data/*txt | sort )
do do
filtername=$( echo $filterfile | rev | cut -f 1 -d "/" | rev | sed "s#.txt\$##g" | sed "s#^[0-9]*_##g" ) 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]" ) filterdata=$( cat ${filterfile} | grep "^[a-zA-Z]" )
filterAll="$filterAll $filterdata"
out=$( echo "$pkgsum" | _filterPkg "${filterdata}" ) out=$( echo "$pkgsum" | _filterPkg "${filterdata}" )
typeset -i iCount=$( echo "$out" | grep "." | wc -l ) typeset -i iCount=$( echo "$out" | grep "." | wc -l )
...@@ -213,7 +220,8 @@ function showFilteredPackages(){ ...@@ -213,7 +220,8 @@ function showFilteredPackages(){
if [ $iFound -eq 0 ]; then if [ $iFound -eq 0 ]; then
echo "No package matched a group filter." echo "No package matched a group filter."
else else
echo "Other packages: $iOther" echo "--- Other packages: $iOther"
echo "$pkgsum" | _filterPkg "${filterAll}" "-v"
fi fi
# total packages # total packages
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment