File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919all : test
2020
2121.PHONY : check
22- check : check-go check-docker check-gotestsum check-ack
22+ check : check-go check-jq check- docker check-gotestsum check-ack
2323 @if [ " $( GOOS) " = " linux" ]; then \
2424 which protoc > /dev/null 2>&1 || (echo " Error: protoc is not installed or not in PATH" && exit 1); \
2525 fi
@@ -32,6 +32,10 @@ check: check-go check-docker check-gotestsum check-ack
3232 fi
3333 @echo " The dgraph binary is a Linux executable (as required)"
3434
35+ .PHONY : check-jq
36+ check-jq :
37+ @./scripts/check-jq.sh
38+
3539.PHONY : check-docker
3640check-docker :
3741 @./scripts/check-docker.sh
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # shellcheck source=checkhelper.sh
5+ source " $( dirname " ${BASH_SOURCE[0]} " ) /checkhelper.sh"
6+
7+ find_jq () {
8+ command -v jq 2> /dev/null
9+ }
10+
11+ install_jq_linux () {
12+ install_linux_pkg " jq"
13+ }
14+
15+ install_jq_macos () {
16+ ensure_brew || exit 1
17+ brew install jq
18+ }
19+
20+ install_jq () {
21+ run_os_installer install_jq_linux install_jq_macos
22+ }
23+
24+ main () {
25+ if find_jq & > /dev/null; then
26+ exit 0
27+ fi
28+
29+ if [[ ${AUTO_INSTALL-} == " true" ]]; then
30+ install_jq
31+ if find_jq & > /dev/null; then
32+ exit 0
33+ else
34+ err " jq check still failing after installation"
35+ exit 1
36+ fi
37+ fi
38+
39+ echo " "
40+ err " jq is not installed"
41+ echo " "
42+ err " Please install jq manually:"
43+
44+ case " $( get_os) " in
45+ Linux)
46+ err " apt: sudo apt-get install jq"
47+ err " dnf: sudo dnf install jq"
48+ err " yum: sudo yum install jq"
49+ err " pacman: sudo pacman -S jq"
50+ ;;
51+ Darwin)
52+ err " brew install jq"
53+ ;;
54+ * )
55+ err " (see https://jqlang.github.io/jq/download/)"
56+ ;;
57+ esac
58+
59+ print_auto_install_hint
60+ exit 1
61+ }
62+
63+ main " $@ "
You can’t perform that action at this time.
0 commit comments