diff --git a/Scripts/Functions/Prepare/prepare.sh b/Scripts/Functions/Prepare/prepare.sh index 586a99b..5554970 100755 --- a/Scripts/Functions/Prepare/prepare.sh +++ b/Scripts/Functions/Prepare/prepare.sh @@ -27,27 +27,34 @@ function prepare { - # Initialize action name variable. Here is where we store the - # name of the actions that will be executed based on the options - # passed in the command-line. - local ACTIONNAM='' - local ACTIONNAMS='' + local PREPARE_ACTIONNAM='' + local PREPARE_ACTIONNAMS='' # Define absolute path to directory holding prepare's # configuration files. - PREPARE_CONFIG_DIR=${FUNCDIR}/${FUNCDIRNAM}/Config + local PREPARE_CONFIG_DIR=${FUNCDIR}/${FUNCDIRNAM}/Config # Interpret arguments and options passed through command-line. - prepare_getOptions + ${FUNCNAM}_getOptions - # Redefine positional parameters using ARGUMENTS. At this point, - # option arguments have been removed from ARGUMENTS variable and - # only non-option arguments remain in it. - eval set -- "$ARGUMENTS" + # Execute action names based on whether they were provided or not. + if [[ $PREPARE_ACTIONNAMS == '' ]];then - # Execute action names. - for ACTIONNAM in $ACTIONNAMS;do - ${ACTIONNAM} - done + # When action names are not provided, define action names that + # will take place, explicitly. + ${FUNCNAM}_updatePackages + ${FUNCNAM}_updateLinks + ${FUNCNAM}_updateImages + ${FUNCNAM}_updateManuals + + else + + # When action names are provided, loop through them and + # execute them one by one. + for PREPARE_ACTIONNAM in $PREPARE_ACTIONNAMS;do + ${FUNCNAM}_${PREPARE_ACTIONNAM} + done + + fi } diff --git a/Scripts/Functions/Prepare/prepare_checkPackages.sh b/Scripts/Functions/Prepare/prepare_checkPackages.sh deleted file mode 100755 index 425f50e..0000000 --- a/Scripts/Functions/Prepare/prepare_checkPackages.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# -# prepare_checkPackages.sh -- This function verifies the required -# packages your workstation needs to have installed in order for -# `centos-art.sh' script to run correctly. If there is one or more -# missing packages, the `centos-art.sh' script asks you to confirm -# their installation through `sudo yum'. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_checkPackages { - - local PACKAGE='' - local PACKAGES='' - local PACKAGES_THIRDS='' - local -a PACKAGES_MISSING - local -a PACKAGES_INSTALL - local RPM='/bin/rpm' - local YUM='/usr/bin/yum' - local YUM_OPTIONS='' - - # Check execution rights of package managers. - cli_checkFiles $RPM --execution - cli_checkFiles $YUM --execution - - # Define required packages needed by centos-art.sh script. - PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp - coreutils texinfo info tetex-latex tetex-fonts tetex-xdvi - tetex-dvips gettext texi2html gnome-doc-utils elinks - docbook-style-xsl docbook-utils docbook-dtds - docbook-style-dsssl docbook-simple docbook-utils-pdf - docbook-slides firefox sudo yum rpm" - - # Define packages from third party repositories (i.e., packages - # not included in CentOS [base] repository.) required by - # centos-art to work as expected. - PACKAGES_THIRDS="(inkscape|blender)" - - # Build list of installed and missing packages. - for PACKAGE in $PACKAGES;do - $RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet - if [[ $? -ne 0 ]];then - PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE - else - PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE - fi - done - - # Define relation between centos-art.sh options and yum options. - [[ $FLAG_ANSWER == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -y" - [[ $FLAG_QUIET == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -q" - - # Use `sudo yum' to install missing packages in your workstation. - if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then - sudo ${YUM} ${YUM_OPTIONS} install ${PACKAGES_MISSING[*]} - fi - - # Use `sudo yum' to update installed packages in your workstation. - if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then - sudo ${YUM} ${YUM_OPTIONS} update ${PACKAGES_INSTALL[*]} - fi - -} diff --git a/Scripts/Functions/Prepare/prepare_doImages.sh b/Scripts/Functions/Prepare/prepare_doImages.sh deleted file mode 100755 index 188ff41..0000000 --- a/Scripts/Functions/Prepare/prepare_doImages.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# prepare_doImages.sh -- This option initializes image files inside -# the working copy. When you provide this option, the centos-art.sh -# scripts renders image files from all design models available in the -# working copy. This step is required in order to satisfy dependencies -# from different components inside the working copy. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_doImages { - - # Define list of directories that need to be rendered. - local DIRS=$(cli_getFilesList \ - ${HOME}/artwork/trunk/Identity/Images --maxdepth="1" \ - --mindepth="1" --type="d" --pattern=".+/[[:alnum:]]+$") - - # Execute the render functionality of centos-art.sh script to - # produce directories inside the list one by one. Producing - # directories one by one is important because themes directory is - # produced differently compared to others directories. This way, - # when we create a list of directories and pass them that way to - # centos-art.sh script, it is possible for ir to know how to - # produce each directory passed. - ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render $DIRS --dont-commit-changes - -} diff --git a/Scripts/Functions/Prepare/prepare_doLinks.sh b/Scripts/Functions/Prepare/prepare_doLinks.sh deleted file mode 100755 index b597bc0..0000000 --- a/Scripts/Functions/Prepare/prepare_doLinks.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash -# -# prepare_doLinks.sh -- This option creates/updates the symbolic links -# information required in your workstation to connect it with the -# files inside the working copy of The CentOS Artwork Repository. When -# you provide this option, the centos-art.sh put itself into your -# system's execution path and make common brushes, patterns, palettes -# and fonts available inside applications like GIMP, so you can make -# use of them without loosing version control over them. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_doLinks { - - local -a LINKS_SRC - local -a LINKS_DST - local USERFILES='' - local PALETTE='' - local BRUSH='' - local PATTERN='' - local FONT='' - local FILE='' - local COUNT=0 - - # Define user's directories. This is the place where configuration - # links are created in. - local GIMP_DIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) - local GIMP_DIR_BRUSHES=${GIMP_DIR}/brushes - local GIMP_DIR_PALETTES=${GIMP_DIR}/palettes - local GIMP_DIR_PATTERNS=${GIMP_DIR}/patterns - local INKS_DIR=${HOME}/.inkscape - local INKS_DIR_PALETTES=${INKS_DIR}/palettes - local FONT_DIR=${HOME}/.fonts - local APPS_DIR=${HOME}/bin - - # Define working copy directories. This is the place where - # configuration links point to. - local WCDIR=$(cli_getRepoTLDir)/Identity - local WCDIR_BRUSHES=${WCDIR}/Brushes - local WCDIR_PALETTES=${WCDIR}/Palettes - local WCDIR_PATTERNS=${WCDIR}/Patterns - local WCDIR_FONTS=${WCDIR}/Fonts - local WCDIR_EDITOR=${PREPARE_CONFIG_DIR} - - # Define link relation for cli. - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${APPS_DIR}/${CLI_PROGRAM} - LINKS_DST[((++${#LINKS_DST[*]}))]=${CLI_BASEDIR}/${CLI_PROGRAM}.sh - USERFILES="${APPS_DIR}/${CLI_PROGRAM}" - - # Define link relation for fonts. - for FONT in $(cli_getFilesList "${WCDIR_FONTS}" --pattern='.+\.ttf');do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${FONT_DIR}/$(basename $FONT) - LINKS_DST[((++${#LINKS_DST[*]}))]=${FONT} - done - - # Define link relation for common palettes. - for PALETTE in $(cli_getFilesList "${WCDIR_PALETTES}" --pattern=".+\.gpl");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${INKS_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} - done - - # Define link relation for common brushes. - for BRUSH in $(cli_getFilesList "${WCDIR_BRUSHES}" --pattern=".+\.(gbr|gih)");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_BRUSHES}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${BRUSH} - done - - # Define link relation for common patterns. - for PATTERN in $(cli_getFilesList "${WCDIR_PATTERNS}" --pattern=".+\.png");do - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PATTERNS}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) - LINKS_DST[((++${#LINKS_DST[*]}))]=${PATTERN} - done - - # Define link relation for Vim text editor's configuration. - if [[ $EDITOR == '/usr/bin/vim' ]];then - LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.vimrc - LINKS_DST[((++${#LINKS_DST[*]}))]=${WCDIR_EDITOR}/vimrc - USERFILES="${USERFILES} ${HOME}/.vimrc" - fi - - # Define which files inside the user's configuration directories - # need to be removed in order for centos-art.sh script to make a - # fresh installation of common patterns, common palettes and - # common brushes using symbolic links from the working copy to the - # user's configuration directories inside the workstation. - USERFILES=$(echo "$USERFILES"; - cli_getFilesList ${APPS_DIR} --pattern='.+\.sh'; - cli_getFilesList ${FONT_DIR} --pattern='.+\.ttf'; - cli_getFilesList ${GIMP_DIR_BRUSHES} --pattern='.+\.(gbr|gih)'; - cli_getFilesList ${GIMP_DIR_PATTERNS} --pattern='.+\.(pat|png|jpg|bmp)'; - cli_getFilesList ${GIMP_DIR_PALETTES} --pattern='.+\.gpl'; - cli_getFilesList ${INKS_DIR_PALETTES} --pattern='.+\.gpl';) - - # Remove user-specific configuration files from user's home - # directory. Otherwise, we might end up having links insid user's - # home directory that don't exist inside the working copy. - if [[ "$USERFILES" != '' ]];then - rm -r $USERFILES - fi - - while [[ $COUNT -lt ${#LINKS_SRC[*]} ]];do - - # Print action message. - cli_printMessage "${LINKS_SRC[$COUNT]}" --as-creating-line - - # Create symbolic link's parent directory if it doesn't exist. - if [[ ! -d $(dirname ${LINKS_SRC[$COUNT]}) ]];then - mkdir -p $(dirname ${LINKS_SRC[$COUNT]}) - fi - - # Create symbolic link. - ln ${LINKS_DST[$COUNT]} ${LINKS_SRC[$COUNT]} --symbolic --force - - # Increment counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Scripts/Functions/Prepare/prepare_doManuals.sh b/Scripts/Functions/Prepare/prepare_doManuals.sh deleted file mode 100755 index dfff3b4..0000000 --- a/Scripts/Functions/Prepare/prepare_doManuals.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# prepare_doManuals.sh -- This option initializes documentation files -# inside the working copy. When you provide this option, the -# centos-art.sh script renders all documentation manuals from their -# related source files so you can read them nicely. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_doManuals { - - # The CentOS Artwork Repository User's Guide in docbook format. - ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render \ - trunk/Manuals/TCAR-UG/Docbook/ --filter="tcar-ug" \ - --dont-commit-changes - - # The CentOS Artwork Repository User's Guide in texinfo format. - ${CLI_BASEDIR}/${CLI_PROGRAM}.sh help --update \ - trunk/Manuals/TCAR-UG/Texinfo/ \ - --dont-commit-changes - -} diff --git a/Scripts/Functions/Prepare/prepare_getOptions.sh b/Scripts/Functions/Prepare/prepare_getOptions.sh index 44f1292..c52b32b 100755 --- a/Scripts/Functions/Prepare/prepare_getOptions.sh +++ b/Scripts/Functions/Prepare/prepare_getOptions.sh @@ -40,15 +40,6 @@ function prepare_getOptions { # parser. eval set -- "$ARGUMENTS" - # Define default behaviour when no option is provided. - if [[ "$@" =~ '^--$' ]];then - ${FUNCNAM}_checkPackages - ${FUNCNAM}_doLinks - ${FUNCNAM}_doImages - ${FUNCNAM}_doManuals - return - fi - # Look for options passed through command-line. while true; do case "$1" in @@ -65,27 +56,27 @@ function prepare_getOptions { ;; --packages ) - ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_checkPackages" + PREPARE_ACTIONNAMS="${ACTIONNAMS} updatePackages" shift 1 ;; --links ) - ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doLinks" + PREPARE_ACTIONNAMS="${ACTIONNAMS} updateLinks" shift 1 ;; --images ) - ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doImages" + PREPARE_ACTIONNAMS="${ACTIONNAMS} updateImages" shift 1 ;; --manuals ) - ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doManuals" + PREPARE_ACTIONNAMS="${ACTIONNAMS} updateManuals" shift 1 ;; --environment ) - ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_getEnvars" + PREPARE_ACTIONNAMS="${ACTIONNAMS} getEnvars" shift 1 ;; diff --git a/Scripts/Functions/Prepare/prepare_updateImages.sh b/Scripts/Functions/Prepare/prepare_updateImages.sh new file mode 100755 index 0000000..06164f6 --- /dev/null +++ b/Scripts/Functions/Prepare/prepare_updateImages.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# prepare_updateImages.sh -- This option initializes image files inside +# the working copy. When you provide this option, the centos-art.sh +# scripts renders image files from all design models available in the +# working copy. This step is required in order to satisfy dependencies +# from different components inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateImages { + + # Define list of directories that need to be rendered. + local DIRS=$(cli_getFilesList \ + ${HOME}/artwork/trunk/Identity/Images --maxdepth="1" \ + --mindepth="1" --type="d" --pattern=".+/[[:alnum:]]+$") + + # Execute the render functionality of centos-art.sh script to + # produce directories inside the list one by one. Producing + # directories one by one is important because themes directory is + # produced differently compared to others directories. This way, + # when we create a list of directories and pass them that way to + # centos-art.sh script, it is possible for ir to know how to + # produce each directory passed. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render $DIRS --dont-commit-changes + +} diff --git a/Scripts/Functions/Prepare/prepare_updateLinks.sh b/Scripts/Functions/Prepare/prepare_updateLinks.sh new file mode 100755 index 0000000..1351238 --- /dev/null +++ b/Scripts/Functions/Prepare/prepare_updateLinks.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# +# prepare_updateLinks.sh -- This option creates/updates the symbolic links +# information required in your workstation to connect it with the +# files inside the working copy of The CentOS Artwork Repository. When +# you provide this option, the centos-art.sh put itself into your +# system's execution path and make common brushes, patterns, palettes +# and fonts available inside applications like GIMP, so you can make +# use of them without loosing version control over them. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateLinks { + + local -a LINKS_SRC + local -a LINKS_DST + local USERFILES='' + local PALETTE='' + local BRUSH='' + local PATTERN='' + local FONT='' + local FILE='' + local COUNT=0 + + # Define user's directories. This is the place where configuration + # links are created in. + local GIMP_DIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) + local GIMP_DIR_BRUSHES=${GIMP_DIR}/brushes + local GIMP_DIR_PALETTES=${GIMP_DIR}/palettes + local GIMP_DIR_PATTERNS=${GIMP_DIR}/patterns + local INKS_DIR=${HOME}/.inkscape + local INKS_DIR_PALETTES=${INKS_DIR}/palettes + local FONT_DIR=${HOME}/.fonts + local APPS_DIR=${HOME}/bin + + # Define working copy directories. This is the place where + # configuration links point to. + local WCDIR=$(cli_getRepoTLDir)/Identity + local WCDIR_BRUSHES=${WCDIR}/Brushes + local WCDIR_PALETTES=${WCDIR}/Palettes + local WCDIR_PATTERNS=${WCDIR}/Patterns + local WCDIR_FONTS=${WCDIR}/Fonts + local WCDIR_EDITOR=${PREPARE_CONFIG_DIR} + + # Define link relation for cli. + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${APPS_DIR}/${CLI_PROGRAM} + LINKS_DST[((++${#LINKS_DST[*]}))]=${CLI_BASEDIR}/${CLI_PROGRAM}.sh + USERFILES="${APPS_DIR}/${CLI_PROGRAM}" + + # Define link relation for fonts. + for FONT in $(cli_getFilesList "${WCDIR_FONTS}" --pattern='.+\.ttf');do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${FONT_DIR}/$(basename $FONT) + LINKS_DST[((++${#LINKS_DST[*]}))]=${FONT} + done + + # Define link relation for common palettes. + for PALETTE in $(cli_getFilesList "${WCDIR_PALETTES}" --pattern=".+\.gpl");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${INKS_DIR_PALETTES}/$(prepare_getLinkName ${WCDIR_PALETTES} ${PALETTE}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PALETTE} + done + + # Define link relation for common brushes. + for BRUSH in $(cli_getFilesList "${WCDIR_BRUSHES}" --pattern=".+\.(gbr|gih)");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_BRUSHES}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${BRUSH} + done + + # Define link relation for common patterns. + for PATTERN in $(cli_getFilesList "${WCDIR_PATTERNS}" --pattern=".+\.png");do + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${GIMP_DIR_PATTERNS}/$(prepare_getLinkName ${WCDIR_BRUSHES} ${BRUSH}) + LINKS_DST[((++${#LINKS_DST[*]}))]=${PATTERN} + done + + # Define link relation for Vim text editor's configuration. + if [[ $EDITOR == '/usr/bin/vim' ]];then + LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.vimrc + LINKS_DST[((++${#LINKS_DST[*]}))]=${WCDIR_EDITOR}/vimrc + USERFILES="${USERFILES} ${HOME}/.vimrc" + fi + + # Define which files inside the user's configuration directories + # need to be removed in order for centos-art.sh script to make a + # fresh installation of common patterns, common palettes and + # common brushes using symbolic links from the working copy to the + # user's configuration directories inside the workstation. + USERFILES=$(echo "$USERFILES"; + cli_getFilesList ${APPS_DIR} --pattern='.+\.sh'; + cli_getFilesList ${FONT_DIR} --pattern='.+\.ttf'; + cli_getFilesList ${GIMP_DIR_BRUSHES} --pattern='.+\.(gbr|gih)'; + cli_getFilesList ${GIMP_DIR_PATTERNS} --pattern='.+\.(pat|png|jpg|bmp)'; + cli_getFilesList ${GIMP_DIR_PALETTES} --pattern='.+\.gpl'; + cli_getFilesList ${INKS_DIR_PALETTES} --pattern='.+\.gpl';) + + # Remove user-specific configuration files from user's home + # directory. Otherwise, we might end up having links insid user's + # home directory that don't exist inside the working copy. + if [[ "$USERFILES" != '' ]];then + rm -r $USERFILES + fi + + while [[ $COUNT -lt ${#LINKS_SRC[*]} ]];do + + # Print action message. + cli_printMessage "${LINKS_SRC[$COUNT]}" --as-creating-line + + # Create symbolic link's parent directory if it doesn't exist. + if [[ ! -d $(dirname ${LINKS_SRC[$COUNT]}) ]];then + mkdir -p $(dirname ${LINKS_SRC[$COUNT]}) + fi + + # Create symbolic link. + ln ${LINKS_DST[$COUNT]} ${LINKS_SRC[$COUNT]} --symbolic --force + + # Increment counter. + COUNT=$(($COUNT + 1)) + + done + +} diff --git a/Scripts/Functions/Prepare/prepare_updateManuals.sh b/Scripts/Functions/Prepare/prepare_updateManuals.sh new file mode 100755 index 0000000..aeab8bb --- /dev/null +++ b/Scripts/Functions/Prepare/prepare_updateManuals.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# prepare_updateManuals.sh -- This option initializes documentation files +# inside the working copy. When you provide this option, the +# centos-art.sh script renders all documentation manuals from their +# related source files so you can read them nicely. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updateManuals { + + # The CentOS Artwork Repository User's Guide in docbook format. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh render \ + trunk/Manuals/TCAR-UG/Docbook/ --filter="tcar-ug" \ + --dont-commit-changes + + # The CentOS Artwork Repository User's Guide in texinfo format. + ${CLI_BASEDIR}/${CLI_PROGRAM}.sh help --update \ + trunk/Manuals/TCAR-UG/Texinfo/ \ + --dont-commit-changes + +} diff --git a/Scripts/Functions/Prepare/prepare_updatePackages.sh b/Scripts/Functions/Prepare/prepare_updatePackages.sh new file mode 100755 index 0000000..bb6ef58 --- /dev/null +++ b/Scripts/Functions/Prepare/prepare_updatePackages.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# prepare_updatePackages.sh -- This function verifies the required +# packages your workstation needs to have installed in order for +# `centos-art.sh' script to run correctly. If there is one or more +# missing packages, the `centos-art.sh' script asks you to confirm +# their installation through `sudo yum'. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_updatePackages { + + local PACKAGE='' + local PACKAGES='' + local PACKAGES_THIRDS='' + local -a PACKAGES_MISSING + local -a PACKAGES_INSTALL + local RPM='/bin/rpm' + local YUM='/usr/bin/yum' + local YUM_OPTIONS='' + + # Check execution rights of package managers. + cli_checkFiles $RPM --execution + cli_checkFiles $YUM --execution + + # Define required packages needed by centos-art.sh script. + PACKAGES="inkscape ImageMagick netpbm netpbm-progs syslinux gimp + coreutils texinfo info tetex-latex tetex-fonts tetex-xdvi + tetex-dvips gettext texi2html gnome-doc-utils elinks + docbook-style-xsl docbook-utils docbook-dtds + docbook-style-dsssl docbook-simple docbook-utils-pdf + docbook-slides firefox sudo yum rpm" + + # Define packages from third party repositories (i.e., packages + # not included in CentOS [base] repository.) required by + # centos-art to work as expected. + PACKAGES_THIRDS="(inkscape|blender)" + + # Build list of installed and missing packages. + for PACKAGE in $PACKAGES;do + $RPM -q --queryformat "%{NAME}\n" $PACKAGE --quiet + if [[ $? -ne 0 ]];then + PACKAGES_MISSING[((++${#PACKAGES_MISSING[*]}))]=$PACKAGE + else + PACKAGES_INSTALL[((++${#PACKAGES_INSTALL[*]}))]=$PACKAGE + fi + done + + # Define relation between centos-art.sh options and yum options. + [[ $FLAG_ANSWER == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -y" + [[ $FLAG_QUIET == 'true' ]] && YUM_OPTIONS="${YUM_OPTIONS} -q" + + # Use `sudo yum' to install missing packages in your workstation. + if [[ ${#PACKAGES_MISSING[*]} -gt 0 ]];then + sudo ${YUM} ${YUM_OPTIONS} install ${PACKAGES_MISSING[*]} + fi + + # Use `sudo yum' to update installed packages in your workstation. + if [[ ${#PACKAGES_INSTALL[*]} -gt 0 ]];then + sudo ${YUM} ${YUM_OPTIONS} update ${PACKAGES_INSTALL[*]} + fi + +}