Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
5dd6c5b0
Commit
5dd6c5b0
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
packages2install: show non matching packages in section other
parent
6f4cd078
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_packages2install
+10
-2
10 additions, 2 deletions
check_packages2install
with
10 additions
and
2 deletions
check_packages2install
+
10
−
2
View file @
5dd6c5b0
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment