Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IML Open Source
icinga-checks
Commits
6cd526a7
Commit
6cd526a7
authored
Jun 07, 2022
by
Hahn Axel (hahn)
Browse files
rename package manager functions
parent
42f9adf3
Changes
3
Hide whitespace changes
Inline
Side-by-side
check_packages2install-pkgmanager/apt.sh
View file @
6cd526a7
...
...
@@ -9,27 +9,27 @@
# ---------------------------------------------------------------
# ah <axel.hahn@iml.unibe.ch>
# 2022-06-03 v1.0 ah first version
# 2022-06-07 v1.1 ah remove text "Nothing to install"
# rename functions
# ===============================================================
# ---------------------------------------------------------------
# command to list of updates
function
apt
G
etUpdates
(){
function
apt
.g
etUpdates
(){
sudo
apt-get
-u
upgrade
--assume-no
}
# ---------------------------------------------------------------
# extract list of packages 2 install
# global string packagemanOut output of update lister command
function
aptPackage
s
(){
function
apt
.get
Package
List
(){
# detect number of line containing "The following packages will be upgraded:"
typeset
-i
local
iStart
iStart
=
$(
echo
"
$packagemanOut
"
|
grep
-n
'^The following packages will be upgraded:'
|
cut
-f
1
-d
':'
)
if
[
$iStart
-eq
0
]
;
then
echo
"Nothing to install"
else
if
[
$iStart
-gt
0
]
;
then
# show packages = text starting with 2 spaces below start line
# packages are delimited with space -> replace with new line
echo
"
$packagemanOut
"
|
sed
-n
$iStart
,
\$
p |
grep
"^
\ \
"
|
sed
"s#^
\ \
##g"
|
tr
" "
"
\n
"
...
...
@@ -39,7 +39,7 @@ function aptPackages(){
# ---------------------------------------------------------------
# get status line on apt based systems (debian, ubuntu)
# global string packagemanOut output of update lister command
function
aptStatus
(){
function
apt
.get
Status
Line
(){
echo
"
$packagemanOut
"
|
grep
"upgraded.*installed"
}
...
...
check_packages2install-pkgmanager/pamac.sh
View file @
6cd526a7
...
...
@@ -9,18 +9,19 @@
# ---------------------------------------------------------------
# ah <axel.hahn@iml.unibe.ch>
# 2022-06-03 v1.0 ah first version
# 2022-06-07 v1.1 ah rename functions
# ===============================================================
# ---------------------------------------------------------------
# command to list of updates
function
pamacGetUpdates
(){
function
pamac
.
GetUpdates
(){
pamac checkupdates
}
# ---------------------------------------------------------------
# extract list of packages 2 install
# global string packagemanOut output of update lister command
function
pamacPackage
s
(){
function
pamac
.get
Package
List
(){
echo
"
$packagemanOut
"
|
grep
--
'->'
}
...
...
check_packages2install-pkgmanager/yum.sh
View file @
6cd526a7
...
...
@@ -9,19 +9,21 @@
# ---------------------------------------------------------------
# ah <axel.hahn@iml.unibe.ch>
# 2022-06-03 v1.0 ah first version
# 2022-06-07 v1.1 ah add sudo for yum --bugfix check-update
# rename functions
# ===============================================================
# ---------------------------------------------------------------
# command to list of updates
function
yumGetUpdates
(){
function
yum
.
GetUpdates
(){
sudo
/usr/bin/yum
-y
check-update
}
# ---------------------------------------------------------------
# extract list of packages 2 install
# global string packagemanOut output of update lister command
function
yumPackage
s
(){
function
yum
.get
Package
List
(){
local
iStart
=
3
# detect number of line containing "Obsoleting Packages"
typeset
-i
iEnd
=
$(
echo
"
$packagemanOut
"
|
grep
-n
'^Obsoleting Packages'
|
cut
-f
1
-d
':'
)
-1
...
...
@@ -34,16 +36,16 @@ function yumPackages(){
# ---------------------------------------------------------------
# get custom status
function
yumStatus
(){
function
yum
.get
Status
Line
(){
if
!
sudo
/usr/bin/yum
--bugfix
check-update 2>&1 |
grep
security
;
then
echo
"Ooops - no output from [/usr/bin/yum --bugfix check-update]"
echo
"Ooops - no output from [
sudo
/usr/bin/yum --bugfix check-update]"
fi
}
# ---------------------------------------------------------------
# extract count of critical packages
# param string text to extract critical counter from
function
yumCritical
(){
function
yum
.get
Critical
List
(){
local
summary
=
"
$1
"
# example outputs:
# I No packages needed for security; 223 packages available
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment