|
|
8d73a3 |
#!/bin/bash
|
|
|
8d73a3 |
#
|
|
|
8d73a3 |
# verify_doPackageCheck.sh -- This function receives a list of
|
|
|
8d73a3 |
# packages and verifies if they are currently installed in your
|
|
|
8d73a3 |
# system. Third party package verification is also done here.
|
|
|
8d73a3 |
#
|
|
|
72c8a5 |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
8d73a3 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
8d73a3 |
#
|
|
|
8d73a3 |
# This program is distributed in the hope that it will be useful, but
|
|
|
8d73a3 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
8d73a3 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
8d73a3 |
# General Public License for more details.
|
|
|
8d73a3 |
#
|
|
|
8d73a3 |
# You should have received a copy of the GNU General Public License
|
|
|
8d73a3 |
# along with this program; if not, write to the Free Software
|
|
|
8d73a3 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
8d73a3 |
# USA.
|
|
|
8d73a3 |
#
|
|
|
8d73a3 |
# ----------------------------------------------------------------------
|
|
|
8d73a3 |
# $Id$
|
|
|
8d73a3 |
# ----------------------------------------------------------------------
|
|
|
8d73a3 |
|
|
|
8d73a3 |
function verify_doPackageCheck {
|
|
|
8d73a3 |
|
|
|
8d73a3 |
local PACKAGE=''
|
|
|
8d73a3 |
|
|
|
8d73a3 |
# Check package manager command existance.
|
|
|
b76c02 |
cli_checkFiles '/bin/rpm' 'x'
|
|
|
8d73a3 |
|
|
|
8d73a3 |
for PACKAGE in $PACKAGES;do
|
|
|
8d73a3 |
|
|
|
8d73a3 |
# Query your system's RPM database.
|
|
|
8d73a3 |
rpm -q --queryformat "%{NAME}\n" $PACKAGE --quiet
|
|
|
8d73a3 |
|
|
|
8d73a3 |
# Define missing packages.
|
|
|
8d73a3 |
if [[ $? -ne 0 ]];then
|
|
|
8d73a3 |
PACKAGES_MISSING[$PACKAGES_COUNT]=$PACKAGE
|
|
|
8d73a3 |
fi
|
|
|
8d73a3 |
|
|
|
8d73a3 |
# Increase package counter.
|
|
|
8d73a3 |
PACKAGES_COUNT=$(($PACKAGES_COUNT + 1))
|
|
|
8d73a3 |
|
|
|
8d73a3 |
done
|
|
|
8d73a3 |
|
|
|
8d73a3 |
# In there is no missing package, end script execution with a
|
|
|
8d73a3 |
# descriptive output.
|
|
|
8d73a3 |
if [[ ${#PACKAGES_MISSING[*]} -eq 0 ]];then
|
|
|
08abde |
cli_printMessage "`gettext "The required packages are already installed."`"
|
|
|
8d73a3 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
8d73a3 |
fi
|
|
|
8d73a3 |
|
|
|
8d73a3 |
}
|