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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Merge requests
!126
centos: fix hiding obsolete packages
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
centos: fix hiding obsolete packages
6516-centos-obsolet-packages
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Hahn Axel (hahn)
requested to merge
6516-centos-obsolet-packages
into
master
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d51a85a0
1 commit,
1 year ago
1 file
+
8
−
5
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
check_packages2install-pkgmanager/yum.sh
+
8
−
5
View file @ d51a85a0
Edit in single-file editor
Open in Web IDE
Show full file
@@ -12,6 +12,7 @@
@@ -12,6 +12,7 @@
# 2022-06-07 v1.1 ah add sudo for yum --bugfix check-update
# 2022-06-07 v1.1 ah add sudo for yum --bugfix check-update
# rename functions
# rename functions
# 2022-08-31 v1.2 ah status line depends on os major version
# 2022-08-31 v1.2 ah status line depends on os major version
# 2023-07-17 v1.3 ah fix hiding obsolete packages
# ===============================================================
# ===============================================================
@@ -27,27 +28,29 @@ function yum.getUpdates(){
@@ -27,27 +28,29 @@ function yum.getUpdates(){
function
yum.getPackageList
(){
function
yum.getPackageList
(){
local
iStart
=
3
local
iStart
=
3
# detect number of line containing "Obsoleting Packages"
# detect number of line containing "Obsoleting Packages"
typeset
-i
local
iEnd
local
iEnd
typeset
-i
iEnd
iEnd
=
$(
echo
"
$packagemanOut
"
|
grep
-n
'^Obsoleting Packages'
|
cut
-f
1
-d
':'
)
-1
iEnd
=
$(
echo
"
$packagemanOut
"
|
grep
-n
'^Obsoleting Packages'
|
cut
-f
1
-d
':'
)
-1
local
sEnd
=
$iEnd
local
sEnd
=
$iEnd
test
"
$iEnd
"
=
"-1"
&&
sEnd
=
'$'
test
"
$iEnd
"
=
"-1"
&&
sEnd
=
'$'
echo
"
$packagemanOut
"
|
sed
-n
${
iStart
}
,
${
sEnd
}
p
test
$iEnd
-gt
$iStart
&&
echo
"
$packagemanOut
"
|
sed
-n
${
iStart
}
,
${
sEnd
}
p
}
}
# ---------------------------------------------------------------
# ---------------------------------------------------------------
# get custom status
# get custom status
function
yum.getStatusLine
(){
function
yum.getStatusLine
(){
typeset
-i
local
_osversion
local
_osversion
typeset
-i
_osversion
_osversion
=
$(
ph.getOSMajor
)
_osversion
=
$(
ph.getOSMajor
)
if
[
$_osversion
-ge
8
]
;
then
if
[
$_osversion
-ge
8
]
;
then
if
!
sudo
/usr/bin/yum
--security
check-update 2>&1 |
grep
"available"
;
then
if
!
sudo
/usr/bin/yum
--security
check-update 2>&1 |
grep
"available"
;
then
echo
"
rc =
$?
[Not detected on v
$_osversion
]
"
echo
"
No update available. rc =
$?
"
fi
fi
else
else
if
!
sudo
/usr/bin/yum
--bugfix
check-update 2>&1 |
grep
security
;
then
if
!
sudo
/usr/bin/yum
--bugfix
check-update 2>&1 |
grep
security
;
then
echo
"
rc =
$?
[Not detected
on v
$_osversion
]
"
echo
"
No update available (older versi
on v
$_osversion
). rc =
$?
"
fi
fi
fi
fi
}
}
Loading