spiegel-keyman/resources/build/jq.inc.sh
Marc Durdin fc4df037bb chore(common): use nvm to select version of node for builds
Used by default only on build agents. See docs/build/node.md and
resources/build/_builder_nvm.sh for documentation of this change.

Fixes: #11376
2024-08-01 05:09:08 +07:00

34 lines
No EOL
716 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
#
if [[ -z "${JQ+x}" ]]; then
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
JQ_THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
# . "${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"
}
fi