Blame Scripts/Bash/Functions/Verify/verify_getPackages.sh

4c79b5
#!/bin/bash
4c79b5
#
466982
# verify_getPackages.sh -- This function queries your system's
4c79b5
# rpm database to verify centos-art.sh required packages existence.
4c79b5
# If there is any missing package, leave a message and quit script
4c79b5
# execution.
4c79b5
#
4c79b5
# Copyright (C) 2009-2010 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or modify
4c79b5
# it under the terms of the GNU General Public License as published by
4c79b5
# the Free Software Foundation; either version 2 of the License, or
4c79b5
# (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
3b853a
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
466982
function verify_getPackages {
4c79b5
4c79b5
    # Define variables as local to avoid conflicts outside.
4c79b5
    local PACKAGE=''
4c79b5
    local PACKAGES=''
3b853a
    local PACKAGE_INFO=''
4c79b5
4c79b5
    # Define required packages needed by centos-art.sh script.
4c79b5
    PACKAGES="bash inkscape ImageMagick netpbm netpbm-progs
4c79b5
        syslinux gimp coreutils texinfo info tetex-latex tetex-fonts
3b853a
        tetex-doc tetex-xdvi tetex-dvips gettext texi2html"
4c79b5
4c79b5
    # Define, from required packages, packages being from third
4c79b5
    # parties (i.e., packages not included in rhel, nor centos [base]
4c79b5
    # repository.).
4c79b5
    PACKAGES_FROM_THIRDS="(inkscape|blender)"
4c79b5
3b853a
    # Output table of packages needed by centos-art.sh script.
4c79b5
    for PACKAGE in $PACKAGES;do
3b853a
        PACKAGE_INFO=$(rpm -q --queryformat "%{SUMMARY}" $PACKAGE \
3b853a
            | tr "\n" ' ' | sed -r 's!^([[:alpha:]])!\u\1!' )
3b853a
        cli_printMessage "$PACKAGE | $PACKAGE_INFO"
3b853a
    done \
3b853a
        | egrep -i $REGEX \
3b853a
        | awk 'BEGIN {FS="|"; format ="%15s|%s\n"
3b853a
                      printf "--------------------------------------------------------------------------------\n"
3b853a
                      printf format, "'`gettext "Package"`' ", " '`gettext "Description"`'"
3b853a
                      printf "--------------------------------------------------------------------------------\n"}
3b853a
                     {printf format, substr($1,0,15), $2}
3b853a
                 END {printf "--------------------------------------------------------------------------------\n"}'
3b853a
3b853a
    cli_printMessage "$(caller)" "AsToKnowMoreLine"
4c79b5
}