|
|
3b853a |
#!/bin/bash
|
|
|
3b853a |
#
|
|
|
a650ba |
# prepare_getOptions.sh -- This function parses command options
|
|
|
a650ba |
# provided to `centos-art.sh' script when the first argument in the
|
|
|
a650ba |
# command-line is the `prepare' word. To parse options, this function
|
|
|
a650ba |
# makes use of getopt program.
|
|
|
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 |
|
|
|
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 )
|
|
|
8cbdc0 |
PREPARE_ACTIONNAMS="${ACTIONNAMS} updatePackages"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--links )
|
|
|
8cbdc0 |
PREPARE_ACTIONNAMS="${ACTIONNAMS} updateLinks"
|
|
|
38d53d |
shift 1
|
|
|
38d53d |
;;
|
|
|
38d53d |
|
|
|
38d53d |
--images )
|
|
|
8cbdc0 |
PREPARE_ACTIONNAMS="${ACTIONNAMS} updateImages"
|
|
|
38d53d |
shift 1
|
|
|
38d53d |
;;
|
|
|
38d53d |
|
|
|
38d53d |
--manuals )
|
|
|
8cbdc0 |
PREPARE_ACTIONNAMS="${ACTIONNAMS} updateManuals"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
--environment )
|
|
|
8cbdc0 |
PREPARE_ACTIONNAMS="${ACTIONNAMS} getEnvars"
|
|
|
8e457b |
shift 1
|
|
|
705eab |
;;
|
|
|
705eab |
|
|
|
705eab |
* )
|
|
|
705eab |
break
|
|
|
705eab |
esac
|
|
|
705eab |
done
|
|
|
705eab |
|
|
|
3b853a |
}
|