-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into update-thredds-5.4
- Loading branch information
Showing
227 changed files
with
2,396 additions
and
1,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.1 2024-05-01T15:04:04Z | ||
2.5.2 2024-07-19T03:04:07Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
#!/usr/bin/env sh | ||
|
||
THIS_FILE="$(readlink -f "$0" || realpath "$0")" | ||
THIS_DIR="$(dirname "${THIS_FILE}")" | ||
COMPOSE_DIR="$(dirname "${THIS_DIR}")/birdhouse" | ||
|
||
export BIRDHOUSE_COMPOSE="${BIRDHOUSE_COMPOSE:-"${COMPOSE_DIR}/birdhouse-compose.sh"}" | ||
export __BIRDHOUSE_SUPPORTED_INTERFACE=True | ||
|
||
USAGE="USAGE: $0 [-h|--help] [-b|--backwards-compatible] [-e|--env-file local-env-file] {info|compose|configs}" | ||
HELP="$USAGE | ||
Manage the Birdhouse software stack. | ||
Commands: | ||
info Print build information | ||
compose Run a \"docker compose\" command for the Birdhouse project | ||
configs Print a command that can be used to load configuration settings as environment variables | ||
Options: | ||
-h, --help Print this message and exit | ||
-b, --backwards-compatible Run in backwards compatible mode | ||
-e, --env-file string Override the local environment file, default is ${COMPOSE_DIR}/env.local | ||
" | ||
|
||
CONFIGS_USAGE="USAGE: $0 configs [-h|--help] [-d|--default] {[-p|--print-config-command] | [-c|--command command]}" | ||
CONFIGS_HELP="$CONFIGS_USAGE | ||
Load or execute commands in the Birdhouse configuration environment. | ||
Options: | ||
-d, --default Only load/print a command for the default configuration settings, not those specified by the local environment file | ||
-p, --print-config-command Print a command that can be used to load configuration settings as environment variables | ||
-c, --command string Execute the given command after loading configuration settings | ||
-q, --quiet Suppress stdout when loading configuration settings for the '--command' option. | ||
Example Usage: | ||
$ ${0} configs -c 'echo \${BIRDHOUSE_FQDN}' | ||
example.com # This is the value of BIRDHOUSE_FQDN as determined by the current configuration settings | ||
$ ${0} configs -p | ||
. /path/to/configs/file/to/source && read_configs | ||
$ eval \$(${0} configs) | ||
$ echo \${BIRDHOUSE_FQDN} | ||
example.com # This is the value of BIRDHOUSE_FQDN as determined by the current configuration settings | ||
" | ||
|
||
READ_CONFIGS_CMD=read_configs | ||
|
||
# Print a command that can be used to load configuration settings as environment variables. | ||
# Modifies the command based on whether the options --backwards-compatible and --env-file are set in order | ||
# to respect these settings if this command is run `eval` later on. | ||
# Tries to set the BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED and BIRDHOUSE_LOCAL_ENV environment variables back to their | ||
# original setting after the command is run with `eval`. | ||
# Known issue: The original setting isn't restored if this script is called with an inline environment variable: | ||
# $ export $BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED=False | ||
# $ BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED=True birdhouse configs -p | ||
# ... | ||
# $ echo $BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED | ||
# True | ||
print_config_command() { | ||
configs_cmd_prefix="export __BIRDHOUSE_SUPPORTED_INTERFACE=True ;" | ||
configs_cmd_suffix="unset __BIRDHOUSE_SUPPORTED_INTERFACE ;" | ||
if [ "${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED+set}" = 'set' ]; then | ||
configs_cmd_prefix="${configs_cmd_prefix} export BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED='${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED}' ;" | ||
fi | ||
if [ "${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED_PREV+set}" = 'set' ]; then | ||
configs_cmd_suffix="${configs_cmd_suffix} export BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED='${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED_PREV}' ;" | ||
elif [ "${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED_UNSET}" = 'True' ]; then | ||
configs_cmd_suffix="${configs_cmd_suffix} unset BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED ;" | ||
fi | ||
|
||
if [ "${BIRDHOUSE_LOCAL_ENV+set}" = 'set' ]; then | ||
configs_cmd_prefix="${configs_cmd_prefix} export BIRDHOUSE_LOCAL_ENV='${BIRDHOUSE_LOCAL_ENV}' ;" | ||
fi | ||
if [ "${BIRDHOUSE_LOCAL_ENV_PREV+set}" = 'set' ]; then | ||
configs_cmd_suffix="${configs_cmd_suffix} export BIRDHOUSE_LOCAL_ENV='${BIRDHOUSE_LOCAL_ENV_PREV}' ;" | ||
elif [ "${BIRDHOUSE_LOCAL_ENV_UNSET}" = 'True' ]; then | ||
configs_cmd_suffix="${configs_cmd_suffix} unset BIRDHOUSE_LOCAL_ENV ;" | ||
fi | ||
|
||
echo "${configs_cmd_prefix} . ${COMPOSE_DIR}/read-configs.include.sh; ${READ_CONFIGS_CMD} ; ${configs_cmd_suffix}" | ||
} | ||
|
||
# Support multiple short flags together (ex: -abc instead of -a -b -c) | ||
# The first argument is the parse function to call once the multiple short flags have been parsed | ||
# The rest of the arguments are the rest arguments to be processed. | ||
parse_multiple_short_flags() { | ||
parse_func=$1 | ||
shift | ||
new_flags="${1%%=*}" | ||
arg_value="${1#*=}" | ||
[ "${arg_value}" = "$1" ] && unset arg_value | ||
new_flags="$(echo "${new_flags#-*}" | sed 's/[a-z]/ -&/g')" | ||
shift | ||
if [ "${arg_value+set}" = 'set' ]; then | ||
# shellcheck disable=SC2086 | ||
${parse_func} ${new_flags} "${arg_value}" "$@" | ||
else | ||
# shellcheck disable=SC2086 | ||
${parse_func} ${new_flags} "$@" | ||
fi | ||
} | ||
|
||
# Parse arguments and options for the configs subcommand | ||
parse_configs_args() { | ||
case "$1" in | ||
-d|--default) | ||
READ_CONFIGS_CMD=read_basic_configs_only | ||
shift | ||
parse_configs_args "$@" | ||
;; | ||
-q|--quiet) | ||
CONFIGS_QUIET=True | ||
shift | ||
parse_configs_args "$@" | ||
;; | ||
-p|--print-config-command) | ||
# Cannot be called with the --command argument as well | ||
[ "${CONFIGS_CMD+set}" = 'set' ] && parse_configs_args 'invalid arg that triggers usage message' | ||
CONFIGS_PRINT=True | ||
shift | ||
parse_configs_args "$@" | ||
;; | ||
-c=*|--command=*) | ||
arg_value="${1#*=}" | ||
shift | ||
parse_configs_args -c "${arg_value}" "$@" | ||
;; | ||
-c|--command) | ||
# Cannot be called with the --print-config-command option as well | ||
[ "${CONFIGS_PRINT}" = 'True' ] && parse_configs_args 'invalid arg that triggers usage message' | ||
shift | ||
CONFIGS_CMD="$1" | ||
shift | ||
parse_configs_args "$@" | ||
;; | ||
-h|--help) | ||
echo "${CONFIGS_HELP}" | more | ||
;; | ||
-??*) | ||
parse_multiple_short_flags parse_configs_args "$@" | ||
;; | ||
'') | ||
# Print the configuration settings command or execute the specified | ||
# command once all other options have been parsed | ||
if [ "${CONFIGS_PRINT}" = 'True' ]; then | ||
print_config_command | ||
elif [ "${CONFIGS_CMD+set}" = 'set' ]; then | ||
if [ "${CONFIGS_QUIET}" = "True" ]; then | ||
eval "$(print_config_command)" > /dev/null | ||
else | ||
eval "$(print_config_command)" | ||
fi | ||
exec /usr/bin/env sh -c "${CONFIGS_CMD}" | ||
else | ||
parse_configs_args 'invalid arg that triggers usage message' | ||
fi | ||
;; | ||
*) | ||
>&2 echo "$CONFIGS_USAGE" | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
|
||
# Parse arguments and options | ||
parse_args() { | ||
case "$1" in | ||
-b|--backwards-compatible) | ||
shift | ||
if [ "${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED+set}" = 'set' ]; then | ||
BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED_PREV="${BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED}" | ||
else | ||
BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED_UNSET="True" | ||
fi | ||
export BIRDHOUSE_BACKWARD_COMPATIBLE_ALLOWED="True" # The argument here takes precedence over the env variable | ||
parse_args "$@" | ||
;; | ||
-e=*|--env-file=*) | ||
arg_value="${1#*=}" | ||
shift | ||
parse_args -e "${arg_value}" "$@" | ||
;; | ||
-e|--env-file) | ||
shift | ||
if [ "${BIRDHOUSE_LOCAL_ENV+set}" = 'set' ]; then | ||
BIRDHOUSE_LOCAL_ENV_PREV="${BIRDHOUSE_LOCAL_ENV}" | ||
else | ||
BIRDHOUSE_LOCAL_ENV_UNSET="True" | ||
fi | ||
BIRDHOUSE_LOCAL_ENV=$(realpath "$1") # The argument here takes precedence over the env variable | ||
export BIRDHOUSE_LOCAL_ENV | ||
shift | ||
parse_args "$@" | ||
;; | ||
info) | ||
shift | ||
"${BIRDHOUSE_COMPOSE}" info "$@" | ||
exit $? | ||
;; | ||
compose) | ||
shift | ||
"${BIRDHOUSE_COMPOSE}" "$@" | ||
exit $? | ||
;; | ||
configs) | ||
shift | ||
parse_configs_args "$@" | ||
;; | ||
-h|--help) | ||
echo "$HELP" | ||
;; | ||
-??*) | ||
parse_multiple_short_flags parse_configs_args "$@" | ||
;; | ||
*) | ||
>&2 echo "$USAGE" | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
|
||
parse_args "$@" |
Oops, something went wrong.