|
|
66b51c |
#!/bin/bash
|
|
|
66b51c |
#
|
|
|
a6bab3 |
# tuneup_doBaseActions.sh -- This function builds one list of files to
|
|
|
a6bab3 |
# process for each file extension supported and applies maintainance
|
|
|
a6bab3 |
# tasks file by file for each one of them.
|
|
|
66b51c |
#
|
|
|
2fe9b7 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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
|
|
|
66b51c |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
66b51c |
# General Public License for more details.
|
|
|
66b51c |
#
|
|
|
66b51c |
# You should have received a copy of the GNU General Public License
|
|
|
66b51c |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
66b51c |
# ----------------------------------------------------------------------
|
|
|
66b51c |
# $Id$
|
|
|
66b51c |
# ----------------------------------------------------------------------
|
|
|
66b51c |
|
|
|
66b51c |
function tuneup_doBaseActions {
|
|
|
66b51c |
|
|
|
79f9ac |
local TUNEUP_CONFIG_DIR=''
|
|
|
79f9ac |
local TUNEUP_BACKEND_DIR=''
|
|
|
79f9ac |
local TUNEUP_BACKEND_INIT=''
|
|
|
a6bab3 |
local TUNEUP_EXTENSION=''
|
|
|
ec4ed8 |
local FILE=''
|
|
|
a6bab3 |
local FILES=''
|
|
|
66b51c |
|
|
|
be7de3 |
# Print separator line.
|
|
|
4a423a |
cli_printMessage '-' --as-separator-line
|
|
|
be7de3 |
|
|
|
3c8d82 |
# Loop through list of supported file extensions.
|
|
|
a6bab3 |
for TUNEUP_EXTENSION in ${TUNEUP_EXTENSIONS};do
|
|
|
0a3f74 |
|
|
|
79f9ac |
# Define backend name based on supported file extensions.
|
|
|
79f9ac |
TUNEUP_BACKEND="${TUNEUP_EXTENSION}"
|
|
|
79f9ac |
|
|
|
79f9ac |
# Define absolute path to directory where backend-specific
|
|
|
79f9ac |
# functionalities are stored in.
|
|
|
79f9ac |
TUNEUP_BACKEND_DIR="${TUNEUP_BASEDIR}/$(cli_getRepoName \
|
|
|
79f9ac |
${TUNEUP_BACKEND} -d)"
|
|
|
79f9ac |
|
|
|
79f9ac |
# Define absolute path to backend initialization script.
|
|
|
79f9ac |
TUNEUP_BACKEND_INIT="${TUNEUP_BACKEND_DIR}/$(cli_getRepoName ${TUNEUP_BACKEND} -f)"
|
|
|
79f9ac |
|
|
|
79f9ac |
# Verify absolute path to backend initialization script. When
|
|
|
79f9ac |
# a file extension is provided, but no backend initialization
|
|
|
79f9ac |
# script exists for it, continue with the next file extension
|
|
|
79f9ac |
# in the list.
|
|
|
79f9ac |
if [[ ! -f ${TUNEUP_BACKEND_INIT} ]];then
|
|
|
79f9ac |
continue
|
|
|
a6bab3 |
fi
|
|
|
a6bab3 |
|
|
|
79f9ac |
# Define absolute path to directory where backend-specific
|
|
|
79f9ac |
# configurations are retrived from.
|
|
|
79f9ac |
TUNEUP_CONFIG_DIR="${TUNEUP_BACKEND_DIR}/Config"
|
|
|
79f9ac |
|
|
|
3c8d82 |
# Build list of files to process using action value as
|
|
|
3c8d82 |
# reference.
|
|
|
a6bab3 |
FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${TUNEUP_EXTENSION}")
|
|
|
a6bab3 |
|
|
|
a6bab3 |
# Verify list of files to process. Assuming no file is found,
|
|
|
a6bab3 |
# evaluate the next supported file extension.
|
|
|
a6bab3 |
if [[ $FILES == '' ]];then
|
|
|
a6bab3 |
continue
|
|
|
66b51c |
fi
|
|
|
66b51c |
|
|
|
79f9ac |
# Export backend-specific functionalities up to the
|
|
|
79f9ac |
# execution environment.
|
|
|
79f9ac |
cli_exportFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \
|
|
|
ec4ed8 |
${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}"
|
|
|
ec4ed8 |
|
|
|
79f9ac |
# Execute backend-specific maintainance tasks.
|
|
|
a6bab3 |
for FILE in $FILES;do
|
|
|
a6bab3 |
cli_printMessage "$FILE" --as-tuningup-line
|
|
|
a6bab3 |
${TUNEUP_BACKEND}
|
|
|
a6bab3 |
done
|
|
|
ec4ed8 |
|
|
|
79f9ac |
# Unset backend-specific functionalities from execution
|
|
|
79f9ac |
# environment. This is required to prevent end up with more
|
|
|
79f9ac |
# than one backend-specifc function initialization, in those
|
|
|
79f9ac |
# cases when different template files are rendered in just one
|
|
|
79f9ac |
# execution of `centos-art.sh' script.
|
|
|
79f9ac |
cli_unsetFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \
|
|
|
ec4ed8 |
${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}"
|
|
|
ec4ed8 |
|
|
|
66b51c |
done
|
|
|
66b51c |
|
|
|
66b51c |
}
|