live-build/functions/arguments.sh

83 lines
1.2 KiB
Bash
Raw Normal View History

2007-09-23 08:04:48 +00:00
#!/bin/sh
## live-build(7) - System Build Scripts
2014-02-08 15:47:02 -01:00
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
2007-09-23 08:04:48 +00:00
Arguments ()
{
ARGUMENTS="$(getopt --longoptions breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options c:huv --shell sh -- "${@}")"
2007-09-23 08:04:48 +00:00
if [ "${?}" != "0" ]
then
2007-09-23 08:04:49 +00:00
Echo_error "terminating" >&2
2007-09-23 08:04:48 +00:00
exit 1
fi
eval set -- "${ARGUMENTS}"
while true
do
case "${1}" in
2007-09-23 08:04:49 +00:00
--breakpoints)
_BREAKPOINTS="true"
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:49 +00:00
;;
-c|--conffile)
_CONFFILE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
2007-09-23 08:04:48 +00:00
;;
--debug)
_DEBUG="true"
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:48 +00:00
;;
--force)
_FORCE="true"
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:48 +00:00
;;
-h|--help)
Man
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:51 +00:00
;;
2007-09-23 08:04:48 +00:00
--quiet)
_QUIET="true"
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:48 +00:00
;;
-u|--usage)
2007-09-23 08:05:17 +00:00
Usage
shift
2007-09-23 08:04:48 +00:00
;;
--verbose)
_VERBOSE="true"
2007-09-23 08:05:17 +00:00
shift
2007-09-23 08:04:48 +00:00
;;
-v|--version)
2012-07-18 19:38:58 +00:00
echo "${VERSION}"
exit 0
2007-09-23 08:04:48 +00:00
;;
--)
2007-09-23 08:05:17 +00:00
shift
break
2007-09-23 08:04:48 +00:00
;;
*)
Echo_error "internal error %s" "${0}"
2007-09-23 08:04:48 +00:00
exit 1
;;
esac
done
}