Commit 6cd526a7 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

rename package manager functions

parent 42f9adf3
......@@ -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 aptGetUpdates(){
function apt.getUpdates(){
sudo apt-get -u upgrade --assume-no
}
# ---------------------------------------------------------------
# extract list of packages 2 install
# global string packagemanOut output of update lister command
function aptPackages(){
function apt.getPackageList(){
# 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.getStatusLine(){
echo "$packagemanOut" | grep "upgraded.*installed"
}
......
......@@ -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 pamacPackages(){
function pamac.getPackageList(){
echo "$packagemanOut" | grep -- '->'
}
......
......@@ -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 yumPackages(){
function yum.getPackageList(){
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.getStatusLine(){
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.getCriticalList(){
local summary="$1"
# example outputs:
# I No packages needed for security; 223 packages available
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment