mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Improve option handling.
* Add support to specify the git branch or revision that should be checked out. * We now `shift` arguments as they are used. Once we've handled them all, if there are still arguments remaining, fail. * Minor `echo` changes.
This commit is contained in:
parent
88ed42f3db
commit
075149ca1d
1 changed files with 32 additions and 7 deletions
|
@ -27,13 +27,21 @@ ScriptVersion="1.0"
|
|||
usage() {
|
||||
cat << EOT
|
||||
|
||||
Usage : ${0##/*/} [options] <install-type>
|
||||
Usage : ${0##/*/} [options] <install-type> <install-type-args>
|
||||
|
||||
Installation types:
|
||||
- stable (default)
|
||||
- daily
|
||||
- daily (ubuntu specific)
|
||||
- git
|
||||
|
||||
Examples:
|
||||
$ ${0##/*/}
|
||||
$ ${0##/*/} stable
|
||||
$ ${0##/*/} daily
|
||||
$ ${0##/*/} git
|
||||
$ ${0##/*/} git develop
|
||||
$ ${0##/*/} git 8c3fadf15ec183e5ce8c63739850d543617e4357
|
||||
|
||||
Options:
|
||||
-h|help Display this message
|
||||
-v|version Display script version
|
||||
|
@ -64,6 +72,7 @@ if [ "$#" -eq 0 ];then
|
|||
ITYPE="stable"
|
||||
else
|
||||
ITYPE=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$ITYPE" != "stable" -a "$ITYPE" != "daily" -a "$ITYPE" != "git" ]; then
|
||||
|
@ -71,6 +80,22 @@ if [ "$ITYPE" != "stable" -a "$ITYPE" != "daily" -a "$ITYPE" != "git" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ $ITYPE = "git" ]; then
|
||||
if [ "$#" -eq 0 ];then
|
||||
GIT_REV="master"
|
||||
else
|
||||
GIT_REV=$1
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 ]; then
|
||||
usage
|
||||
echo
|
||||
echo " * ERROR: Too many arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Root permissions are required to run this script
|
||||
if [ $(whoami) != "root" ] ; then
|
||||
echo " * ERROR: Salt requires root privileges to install. Please re-run this script as root."
|
||||
|
@ -261,11 +286,11 @@ __function_defined() {
|
|||
}
|
||||
__gather_system_info
|
||||
|
||||
echo " System Information:"
|
||||
echo " OS Name: ${OS_NAME}"
|
||||
echo " OS Version: ${OS_VERSION}"
|
||||
echo " Machine: ${MACHINE}"
|
||||
echo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"
|
||||
echo " * System Information:"
|
||||
echo " OS Name: ${OS_NAME}"
|
||||
echo " OS Version: ${OS_VERSION}"
|
||||
echo " Machine: ${MACHINE}"
|
||||
echo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"
|
||||
|
||||
|
||||
# Simplify version naming on functions
|
||||
|
|
Loading…
Add table
Reference in a new issue