Parse options
This commit is contained in:
parent
3dba4f7fc1
commit
d26aea7ab2
|
@ -120,10 +120,50 @@ test -f /etc/evomaintenance.cf && . /etc/evomaintenance.cf
|
|||
[ -n "${OPT_DB}" ] || OPT_DB=1
|
||||
[ -n "${OPT_MAIL}" ] || OPT_MAIL=1
|
||||
|
||||
# Parse options
|
||||
while :; do
|
||||
case $1 in
|
||||
# -h|-\?|--help) # Call a "show_help" function to display a synopsis, then exit.
|
||||
# show_help
|
||||
# exit
|
||||
# ;;
|
||||
--no-commit) # Takes an option argument
|
||||
OPT_COMMIT=0
|
||||
;;
|
||||
--commit) # Takes an option argument
|
||||
OPT_COMMIT=1
|
||||
;;
|
||||
--no-db) # Takes an option argument
|
||||
OPT_DB=0
|
||||
;;
|
||||
--db) # Takes an option argument
|
||||
OPT_DB=1
|
||||
;;
|
||||
--no-mail) # Takes an option argument
|
||||
OPT_MAIL=0
|
||||
;;
|
||||
--mail) # Takes an option argument
|
||||
OPT_MAIL=1
|
||||
;;
|
||||
--) # End of all options.
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-?*)
|
||||
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
break
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
# Treat unset variables as an error when substituting.
|
||||
# Only after this line, because some config variables might be missing.
|
||||
set -u
|
||||
|
||||
# Gather information
|
||||
REAL_HOSTNAME=$(get_fqdn)
|
||||
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
|
||||
HOSTNAME_TEXT="${HOSTNAME}"
|
||||
|
|
Loading…
Reference in a new issue