2007-09-23 08:04:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# arguments.sh - handle common arguments
|
|
|
|
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
|
|
|
|
#
|
|
|
|
# live-helper 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.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
Arguments ()
|
|
|
|
{
|
2007-09-23 08:04:49 +00:00
|
|
|
ARGUMENTS="`getopt --longoptions conffile:,debug,force,help,logfile:,quiet,usage,verbose,version --name=${PROGRAM} --options 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
|
|
|
|
--conffile)
|
2007-09-23 08:04:49 +00:00
|
|
|
CONFFILE="${2}"; shift 2
|
2007-09-23 08:04:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
--debug)
|
2007-09-23 08:04:49 +00:00
|
|
|
DEBUG="true"; shift
|
2007-09-23 08:04:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
--force)
|
|
|
|
FORCE="true"; shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
-h|--help)
|
|
|
|
Help; shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--logfile)
|
2007-09-23 08:04:49 +00:00
|
|
|
LOGFILE="${2}"; shift 2
|
2007-09-23 08:04:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
--quiet)
|
2007-09-23 08:04:49 +00:00
|
|
|
QUIET="true"; shift
|
2007-09-23 08:04:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
-u|--usage)
|
|
|
|
Usage; shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--verbose)
|
2007-09-23 08:04:49 +00:00
|
|
|
VERBOSE="true"; shift
|
2007-09-23 08:04:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
-v|--version)
|
|
|
|
Version; shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--)
|
|
|
|
shift; break
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2007-09-23 08:04:49 +00:00
|
|
|
Echo_error "internal error"
|
2007-09-23 08:04:48 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|