|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# prepare_updatePackages.sh -- This function verifies the required
|
|
Alain Reguera Delgado |
8f60cb |
# packages your workstation needs to have installed in order for
|
|
Alain Reguera Delgado |
8f60cb |
# `centos-art.sh' script to run correctly. If there is one or more
|
|
Alain Reguera Delgado |
8f60cb |
# missing packages, the `centos-art.sh' script asks you to confirm
|
|
Alain Reguera Delgado |
8f60cb |
# their installation through `sudo yum'.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# Copyright (C) 2009-2013 The CentOS Project
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
8f60cb |
# it under the terms of the GNU General Public License as published by
|
|
Alain Reguera Delgado |
8f60cb |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
Alain Reguera Delgado |
8f60cb |
# your option) any later version.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is distributed in the hope that it will be useful, but
|
|
Alain Reguera Delgado |
8f60cb |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
8f60cb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
8f60cb |
# General Public License for more details.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
8f60cb |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
8f60cb |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
# $Id$
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
function prepare_updatePackages {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
local PACKAGE=''
|
|
Alain Reguera Delgado |
8f60cb |
local PACKAGES=''
|
|
Alain Reguera Delgado |
8f60cb |
local PACKAGES_THIRDS=''
|
|
Alain Reguera Delgado |
8f60cb |
local -a PACKAGES_MISSING
|
|
Alain Reguera Delgado |
8f60cb |
local -a PACKAGES_INSTALL
|
|
Alain Reguera Delgado |
8f60cb |
local RPM='/bin/rpm'
|
|
Alain Reguera Delgado |
8f60cb |
local YUM='/usr/bin/yum'
|
|
Alain Reguera Delgado |
8f60cb |
local YUM_OPTIONS=''
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Check execution rights of package managers.
|
|
Alain Reguera Delgado |
8f60cb |
cli_checkFiles -x $RPM
|
|
Alain Reguera Delgado |
8f60cb |
cli_checkFiles -x $YUM
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define required packages needed by centos-art.sh script.
|
|
Alain Reguera Delgado |
8f60cb |
PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp
|
|
Alain Reguera Delgado |
8f60cb |
coreutils texinfo texinfo-tex info tetex-latex tetex-fonts
|
|
Alain Reguera Delgado |
8f60cb |
tetex-xdvi tetex-dvips gettext texi2html gnome-doc-utils
|
|
Alain Reguera Delgado |
8f60cb |
elinks docbook-style-xsl docbook-utils docbook-dtds
|
|
Alain Reguera Delgado |
8f60cb |
docbook-style-dsssl docbook-simple docbook-utils-pdf
|
|
Alain Reguera Delgado |
8f60cb |
docbook-slides firefox sudo yum rpm ctags vim-enhanced"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define packages from third party repositories (i.e., packages
|
|
Alain Reguera Delgado |
8f60cb |
# not included in CentOS [base] repository.) required by
|
|
Alain Reguera Delgado |
8f60cb |
# centos-art to work as expected.
|
|
Alain Reguera Delgado |
8f60cb |
PACKAGES_THIRDS="(inkscape|blender)"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Build list of installed and missing packages.
|
|
Alain Reguera Delgado |
8f60cb |
for PACKAGE in $PACKAGES;do
|
|
Alain Reguera Delgado |
8f60cb |
$RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet
|
|
Alain Reguera Delgado |
8f60cb |
if [[ $? -ne 0 ]];then
|
|
Alain Reguera Delgado |
8f60cb |
PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
done
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define relation between centos-art.sh options and yum options.
|
|
Alain Reguera Delgado |
8f60cb |
[[ $FLAG_ANSWER == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -y"
|
|
Alain Reguera Delgado |
8f60cb |
[[ $FLAG_QUIET == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -q"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Use `sudo yum' to install missing packages in your workstation.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then
|
|
Alain Reguera Delgado |
8f60cb |
sudo ${YUM} ${YUM_OPTIONS} install ${PACKAGES_MISSING[*]}
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Use `sudo yum' to update installed packages in your workstation.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then
|
|
Alain Reguera Delgado |
8f60cb |
sudo ${YUM} ${YUM_OPTIONS} update ${PACKAGES_INSTALL[*]}
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|