|
|
3b853a |
#!/bin/bash
|
|
|
3b853a |
#
|
|
|
6449f4 |
# prepare_getOptions.sh -- This function interpretes option parameters
|
|
|
6449f4 |
# passed to `prepare' functionality and calls actions accordingly.
|
|
|
3b853a |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
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
|
|
|
3b853a |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
3b853a |
# General Public License for more details.
|
|
|
3b853a |
#
|
|
|
3b853a |
# You should have received a copy of the GNU General Public License
|
|
|
3b853a |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
3b853a |
# ----------------------------------------------------------------------
|
|
|
3b853a |
# $Id$
|
|
|
3b853a |
# ----------------------------------------------------------------------
|
|
|
3b853a |
|
|
|
6449f4 |
function prepare_getOptions {
|
|
|
3b853a |
|
|
|
705eab |
# Define short options we want to support.
|
|
|
705eab |
local ARGSS=""
|
|
|
3b853a |
|
|
|
705eab |
# Define long options we want to support.
|
|
|
38d53d |
local ARGSL="quiet,answer-yes,packages,links,images,manuals,environment"
|
|
|
3b853a |
|
|
|
705eab |
# Parse arguments using getopt(1) command parser.
|
|
|
793c4c |
cli_parseArguments
|
|
|
3b853a |
|
|
|
705eab |
# Reset positional parameters using output from (getopt) argument
|
|
|
705eab |
# parser.
|
|
|
705eab |
eval set -- "$ARGUMENTS"
|
|
|
08abde |
|
|
|
38d53d |
# Define default behaviour when no option is provided.
|
|
|
38d53d |
if [[ "$@" =~ '^--$' ]];then
|
|
|
38d53d |
${FUNCNAM}_doPackages
|
|
|
38d53d |
${FUNCNAM}_doLinks
|
|
|
38d53d |
${FUNCNAM}_doImages
|
|
|
38d53d |
${FUNCNAM}_doManuals
|
|
|
38d53d |
return
|
|
|
38d53d |
fi
|
|
|
38d53d |
|
|
|
705eab |
# Look for options passed through command-line.
|
|
|
705eab |
while true; do
|
|
|
705eab |
case "$1" in
|
|
|
705eab |
|
|
|
65dd41 |
--quiet )
|
|
|
65dd41 |
FLAG_QUIET="true"
|
|
|
65dd41 |
FLAG_DONT_COMMIT_CHANGES="true"
|
|
|
65dd41 |
shift 1
|
|
|
65dd41 |
;;
|
|
|
65dd41 |
|
|
|
3ccb0a |
--answer-yes )
|
|
|
3ccb0a |
FLAG_ANSWER="true"
|
|
|
3ccb0a |
shift 1
|
|
|
65dd41 |
;;
|
|
|
65dd41 |
|
|
|
705eab |
--packages )
|
|
|
38d53d |
ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doPackages"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--links )
|
|
|
38d53d |
ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doLinks"
|
|
|
38d53d |
shift 1
|
|
|
38d53d |
;;
|
|
|
38d53d |
|
|
|
38d53d |
--images )
|
|
|
38d53d |
ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doImages"
|
|
|
38d53d |
shift 1
|
|
|
38d53d |
;;
|
|
|
38d53d |
|
|
|
38d53d |
--manuals )
|
|
|
38d53d |
ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_doManuals"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--environment )
|
|
|
0be214 |
ACTIONNAMS="${ACTIONNAMS} ${FUNCNAM}_getEnvars"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
* )
|
|
|
705eab |
break
|
|
|
705eab |
esac
|
|
|
705eab |
done
|
|
|
705eab |
|
|
|
3b853a |
}
|