Bomb out with Bash < 4

Ref #96
This commit is contained in:
3wc 2021-03-14 03:24:13 +02:00
parent 946d1a068d
commit fd655274f8
2 changed files with 10 additions and 6 deletions

View File

@ -10,6 +10,7 @@
- Support removal of secrets and volumes when `rm`'ing apps ([#44](https://git.autonomic.zone/coop-cloud/abra/issues/44)) - Support removal of secrets and volumes when `rm`'ing apps ([#44](https://git.autonomic.zone/coop-cloud/abra/issues/44))
- Always choose the default IPv4 address with `abra server <host> init` ([#91](https://git.autonomic.zone/coop-cloud/abra/issues/91)) - Always choose the default IPv4 address with `abra server <host> init` ([#91](https://git.autonomic.zone/coop-cloud/abra/issues/91))
- Add `--type=<type>` filtering option to `abra <app> ls` ([0828189](https://git.autonomic.zone/coop-cloud/abra/commit/0828189)) - Add `--type=<type>` filtering option to `abra <app> ls` ([0828189](https://git.autonomic.zone/coop-cloud/abra/commit/0828189))
- Check for bash 4+ ([#96](https://git.autonomic.zone/coop-cloud/abra/commit/0828189))
# abra 0.5.0 (2021-03-01) # abra 0.5.0 (2021-03-01)

15
abra
View File

@ -390,6 +390,13 @@ fi
###### Safety checks ###### Safety checks
require_bash_4() {
# we're using things like `mapfile` which require bash 4+
if ! bash -c '[[ $BASH_VERSION > 4.0 ]]'; then
error "bash version '$BASH_VERSION' is too old, 4 or newer required"
fi
}
require_pwqgen() { require_pwqgen() {
if ! type pwqgen > /dev/null 2>&1; then if ! type pwqgen > /dev/null 2>&1; then
error "pwqgen program is not installed" error "pwqgen program is not installed"
@ -406,12 +413,6 @@ require_abra_dir() {
mkdir -p "$ABRA_DIR" mkdir -p "$ABRA_DIR"
} }
require_stack() {
if [ -z "$STACK_NAME" ]; then
error "no stack_name, export \$STACK_NAME=my_cool_app"
fi
}
require_app_latest() { require_app_latest() {
APP="$1" APP="$1"
APP_DIR="$ABRA_DIR/apps/$APP" APP_DIR="$ABRA_DIR/apps/$APP"
@ -1634,6 +1635,8 @@ sub_network() {
####################################### #######################################
abra() { abra() {
require_bash_4
# TODO (3wc): we either need to do this, or add 'shellcheck disable' all over # TODO (3wc): we either need to do this, or add 'shellcheck disable' all over
# the place to handle the dynamically-defined vars # the place to handle the dynamically-defined vars
declare abra___stack abra___env abra__command_ abra__args_ \ declare abra___stack abra___env abra__command_ abra__args_ \