|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
8e457b |
# prepare_doPackages.sh -- This function verifies the required
|
|
|
8e457b |
# packages your workstation needs to have installed in order for
|
|
|
8e457b |
# centos-art command to run correctly. If there is one or more missing
|
|
|
8e457b |
# packages, the `centos-art.sh' script asks you to confirm their
|
|
|
8e457b |
# installation through yum.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# 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
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
3b853a |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
1700f3 |
function prepare_doPackages {
|
|
|
4c79b5 |
|
|
|
8e457b |
# Verify `--packages' option.
|
|
|
8e457b |
if [[ $FLAG_PACKAGES == 'false' ]];then
|
|
|
8e457b |
return
|
|
|
8e457b |
fi
|
|
|
8e457b |
|
|
|
8e457b |
local PACKAGE=''
|
|
|
8e457b |
local WARNING=''
|
|
|
4c79b5 |
local PACKAGES=''
|
|
|
8e457b |
local PACKAGES_THIRDS=''
|
|
|
8d73a3 |
local -a PACKAGES_MISSING
|
|
|
a03fb8 |
local -a PACKAGES_INSTALL
|
|
|
8e457b |
local RPM='/bin/rpm'
|
|
|
8e457b |
local YUM='/usr/bin/yum'
|
|
|
8e457b |
|
|
|
8e457b |
# Check execution rights of package managers.
|
|
|
8e457b |
cli_checkFiles $RPM 'x'
|
|
|
8e457b |
cli_checkFiles $YUM 'x'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define required packages needed by centos-art.sh script.
|
|
|
8e457b |
PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp
|
|
|
8e457b |
coreutils texinfo info tetex-latex tetex-fonts tetex-xdvi
|
|
|
8e457b |
tetex-dvips gettext texi2html gnome-doc-utils elinks
|
|
|
8e457b |
docbook-style-xsl docbook-utils docbook-dtds
|
|
|
8e457b |
docbook-style-dsssl docbook-simple docbook-utils-pdf
|
|
|
8e457b |
docbook-slides firefox sudo yum rpm"
|
|
|
8e457b |
|
|
|
8e457b |
# Define packages from third party repositories (i.e., packages
|
|
|
8e457b |
# not included in CentOS [base] repository.) required by
|
|
|
8e457b |
# centos-art to work as expected.
|
|
|
8e457b |
PACKAGES_THIRDS="(inkscape|blender)"
|
|
|
8e457b |
|
|
|
a03fb8 |
# Build list of installed and missing packages.
|
|
|
8e457b |
for PACKAGE in $PACKAGES;do
|
|
|
8e457b |
$RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet
|
|
|
8e457b |
if [[ $? -ne 0 ]];then
|
|
|
8e457b |
PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE
|
|
|
a03fb8 |
else
|
|
|
a03fb8 |
PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE
|
|
|
8e457b |
fi
|
|
|
8e457b |
done
|
|
|
8e457b |
|
|
|
a03fb8 |
# Use `sudo yum' to install missing packages in your workstation.
|
|
|
a03fb8 |
if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then
|
|
|
a03fb8 |
sudo ${YUM} install ${PACKAGES_MISSING[*]}
|
|
|
a03fb8 |
fi
|
|
|
a03fb8 |
|
|
|
a03fb8 |
# Use `sudo yum' to update installed packages in your workstation.
|
|
|
a03fb8 |
if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then
|
|
|
a03fb8 |
sudo ${YUM} update ${PACKAGES_INSTALL[*]}
|
|
|
8e457b |
fi
|
|
|
8d73a3 |
|
|
|
4c79b5 |
}
|