spiegel-keyman/resources/build/jq.inc.sh
Marc Durdin 767927bf16 chore(common): use /usr/bin/env bash
Fixes up scripts (except under /linux) to use `#!/usr/bin/env bash`
instead of `#!/bin/bash` or `#!/bin/sh` so that we don't end up with
the ancient version of bash supplied with macOS.

This became urgent with this PR, because of bash-4.xisms in
build-utils.sh, for example on line 572:

```
if [[ -v _builder_params[$e] ]]; then
```
2022-07-25 14:59:37 +10:00

32 lines
700 B
Bash

#!/usr/bin/env bash
#
# Setup JQ environment variable according to the user's system
#
# Windows: /resources/build/jq-win64.exe
# Linux/macOS: jq
#
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
JQ_THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
# . "$(dirname "$THIS_SCRIPT")/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
case "${OSTYPE}" in
"cygwin")
JQ=$(dirname "$JQ_THIS_SCRIPT")/jq-win64.exe
;;
"msys")
JQ=$(dirname "$JQ_THIS_SCRIPT")/jq-win64.exe
;;
*)
JQ=jq
;;
esac
readonly JQ
# JQ with inplace file replacement
function jqi() {
cat <<< "$($JQ -c "$1" < "$2")" > "$2"
}