|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
ab1d67 |
# render_getActions.sh -- This function interprets arguments passed to
|
|
|
07c2fe |
# render functionality and calls actions accordingly.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# 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
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
ab1d67 |
function render_getActions {
|
|
|
4c79b5 |
|
|
|
07c2fe |
# Define short options we want to support.
|
|
|
15b1d2 |
local ARGSS=""
|
|
|
4c79b5 |
|
|
|
07c2fe |
# Define long options we want to support.
|
|
|
eb2fa0 |
local ARGSL="render:,releasever:,basearch:,copy:,to:,convert-to:,group-by:,theme-model:"
|
|
|
4c79b5 |
|
|
|
07c2fe |
# Parse arguments using getopt(1) command parser.
|
|
|
07c2fe |
cli_doParseArguments
|
|
|
4c79b5 |
|
|
|
07c2fe |
# Reset positional parameters using output from (getopt) argument
|
|
|
07c2fe |
# parser.
|
|
|
07c2fe |
eval set -- "$ARGUMENTS"
|
|
|
4c79b5 |
|
|
|
07c2fe |
# Look for options passed through command-line.
|
|
|
07c2fe |
while true; do
|
|
|
4c79b5 |
|
|
|
07c2fe |
case "$1" in
|
|
|
4c79b5 |
|
|
|
05d9ae |
--releasever )
|
|
|
a615b0 |
FLAG_RELEASE="$2"
|
|
|
a615b0 |
if [[ ! $FLAG_RELEASE =~ $(cli_getPathComponent '--release-pattern') ]];then
|
|
|
05d9ae |
cli_printMessage "`gettext "The release version provided is not supported."`" 'AsErrorLine'
|
|
|
a615b0 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
a615b0 |
fi
|
|
|
15b1d2 |
shift 2
|
|
|
15b1d2 |
;;
|
|
|
15b1d2 |
|
|
|
05d9ae |
--basearch )
|
|
|
a615b0 |
FLAG_ARCHITECTURE="$2"
|
|
|
a615b0 |
if [[ ! $FLAG_ARCHITECTURE =~ $(cli_getPathComponent '--architecture-pattern') ]];then
|
|
|
a615b0 |
cli_printMessage "`gettext "The architecture provided is not supported."`" 'AsErrorLine'
|
|
|
a615b0 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
a615b0 |
fi
|
|
|
a615b0 |
shift 2
|
|
|
15b1d2 |
;;
|
|
|
15b1d2 |
|
|
|
a615b0 |
--to )
|
|
|
a615b0 |
FLAG_TO="$2"
|
|
|
ae711e |
shift 2
|
|
|
ae711e |
;;
|
|
|
ae711e |
|
|
|
05d9ae |
--convert-to )
|
|
|
ef0114 |
FLAG_CONVERT_TO="$2"
|
|
|
ae711e |
shift 2
|
|
|
ae711e |
;;
|
|
|
ae711e |
|
|
|
eb2fa0 |
--group-by )
|
|
|
ef0114 |
FLAG_GROUPED_BY="$2"
|
|
|
ef0114 |
shift 2
|
|
|
ef0114 |
;;
|
|
|
ef0114 |
|
|
|
ef0114 |
--theme-model )
|
|
|
ef0114 |
FLAG_THEME_MODEL=$(cli_getRepoName "$2" 'd')
|
|
|
a615b0 |
shift 2
|
|
|
07c2fe |
;;
|
|
|
4c79b5 |
|
|
|
07c2fe |
* )
|
|
|
07c2fe |
# Break options loop.
|
|
|
07c2fe |
break
|
|
|
07c2fe |
esac
|
|
|
07c2fe |
done
|
|
|
07c2fe |
|
|
|
c25cec |
# Read remaining arguments and build the action value from them.
|
|
|
c25cec |
# At this point all options should be processed.
|
|
|
c25cec |
for ACTIONVAL in "$@";do
|
|
|
c25cec |
|
|
|
c25cec |
if [[ $ACTIONVAL == '--' ]];then
|
|
|
c25cec |
continue
|
|
|
c25cec |
fi
|
|
|
c25cec |
|
|
|
c25cec |
# Check action value. Be sure the action value matches the
|
|
|
c25cec |
# convenctions defined for source locations inside the working
|
|
|
c25cec |
# copy.
|
|
|
c25cec |
cli_checkRepoDirSource
|
|
|
c25cec |
|
|
|
c25cec |
# Syncronize changes between the working copy and the central
|
|
|
c25cec |
# repository to bring down changes.
|
|
|
c25cec |
cli_syncroRepoChanges
|
|
|
c25cec |
|
|
|
c25cec |
# Execute action name.
|
|
|
c25cec |
eval ${FUNCNAM}_render
|
|
|
c25cec |
|
|
|
c25cec |
# Syncronize changes between the working copy and the central
|
|
|
c25cec |
# repository to commit up changes.
|
|
|
c25cec |
cli_commitRepoChanges
|
|
|
c25cec |
|
|
|
c25cec |
done
|
|
|
a615b0 |
|
|
|
4c79b5 |
}
|