Blame Automation/Modules/Prepare/prepare_setPackages.sh

Alain Reguera Delgado ff1822
#!/bin/bash
Alain Reguera Delgado ff1822
######################################################################
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
#   prepare_setPackages.sh -- This function verifies packages
Alain Reguera Delgado ff1822
#   required by centos-art.sh script and prints a list of installed
Alain Reguera Delgado ff1822
#   and missing packages based on it.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
#   Written by:
Alain Reguera Delgado ff1822
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado ff1822
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado ff1822
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado ff1822
# your option) any later version.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado ff1822
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado ff1822
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado ff1822
# General Public License for more details.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado ff1822
# along with this program; if not, write to the Free Software
Alain Reguera Delgado ff1822
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado ff1822
#
Alain Reguera Delgado ff1822
######################################################################
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
function prepare_setPackages {
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    local PACKAGES_REQUIRED="inkscape ImageMagick netpbm
Alain Reguera Delgado ff1822
    netpbm-progs syslinux gimp coreutils texinfo texinfo-tex info
Alain Reguera Delgado ff1822
    tetex-latex tetex-fonts tetex-xdvi tetex-dvips gettext texi2html
Alain Reguera Delgado ff1822
    gnome-doc-utils elinks docbook-style-xsl docbook-utils
Alain Reguera Delgado ff1822
    docbook-dtds docbook-style-dsssl docbook-simple docbook-utils-pdf
Alain Reguera Delgado ff1822
    docbook-slides firefox sudo yum rpm ctags vim-enhanced asciidoc
Alain Reguera Delgado ff1822
    dblatex"
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    local -x  PACKAGES_THIRDPARTY='(inkscape|asciidoc|dblatex)'
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    for PACKAGE in ${PACKAGES_REQUIRED};do
Alain Reguera Delgado ff1822
        rpm -q ${PACKAGE} --quiet
Alain Reguera Delgado ff1822
        if [[ $? -ne 0 ]];then
Alain Reguera Delgado ff1822
            PACKAGES_UNINSTALLED="${PACKAGES_UNINSTALLED} ${PACKAGE}"
Alain Reguera Delgado ff1822
        fi
Alain Reguera Delgado ff1822
    done
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    local YUM_OPTIONS=''
Alain Reguera Delgado ff1822
    if [[ ${TCAR_FLAG_YES} == 'true' ]];then
Alain Reguera Delgado ff1822
        YUM_OPTIONS='-y'
Alain Reguera Delgado ff1822
    fi
Alain Reguera Delgado ff1822
    if [[ ${TCAR_FLAG_QUIET} == 'true' ]];then
Alain Reguera Delgado ff1822
        YUM_OPTIONS="${YUM_OPTIONS} --quiet"
Alain Reguera Delgado ff1822
    fi
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
    if [[ ! -z ${PACKAGES_UNINSTALLED} ]];then
Alain Reguera Delgado d0f373
        tcar_printMessage "`gettext "The following packages need to be installed:"`" --as-banner-line
Alain Reguera Delgado ff1822
        for PACKAGE in ${PACKAGES_UNINSTALLED};do
Alain Reguera Delgado ff1822
            if [[ ${PACKAGE} =~ ${PACKAGES_THIRDPARTY} ]];then
Alain Reguera Delgado d0f373
                tcar_printMessage "${PACKAGE} (`gettext "from third party repository"`)" --as-response-line
Alain Reguera Delgado ff1822
            else
Alain Reguera Delgado d0f373
                tcar_printMessage "${PACKAGE}" --as-response-line
Alain Reguera Delgado ff1822
            fi
Alain Reguera Delgado ff1822
        done
Alain Reguera Delgado d0f373
        tcar_printMessage '-' --as-separator-line
Alain Reguera Delgado d0f373
        tcar_printMessage "`gettext "Do you want to continue"`" --as-yesornorequest-line
Alain Reguera Delgado ff1822
        sudo yum install ${YUM_OPTIONS} ${PACKAGES_UNINSTALLED}
Alain Reguera Delgado ff1822
    else
Alain Reguera Delgado d0f373
        tcar_printMessage "`gettext "All required packages are already installed."`" --as-banner-line
Alain Reguera Delgado ff1822
    fi
Alain Reguera Delgado ff1822
Alain Reguera Delgado ff1822
}