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
92a8b240
Commit
92a8b240
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
packages2install: put filtered view into function
parent
0b709ee7
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
+42
-35
42 additions, 35 deletions
check_packages2install
with
42 additions
and
35 deletions
check_packages2install
+
42
−
35
View file @
92a8b240
...
@@ -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
...
...
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