diff --git a/src/Makefile b/src/Makefile index 36d97be..6f36d56 100644 --- a/src/Makefile +++ b/src/Makefile @@ -107,7 +107,8 @@ INSTALL_FILES = \ mips/egrep: @mkdir -p mips - wget -O mips/egrep -c https://busybox.net/downloads/binaries/latest/busybox-mips + wget -O $@ -c https://busybox.net/downloads/binaries/latest/busybox-mips + chmod a+x $@ dist.mips.tar.gz: mips/$(TARGET) $(INSTALL_FILES) mips/egrep tar -c -z -f $@ --transform='s/^mips\///' mips/$(TARGET) $(INSTALL_FILES) mips/egrep diff --git a/src/shinc/common.sh b/src/shinc/common.sh index 43d496c..4e49344 100644 --- a/src/shinc/common.sh +++ b/src/shinc/common.sh @@ -55,6 +55,13 @@ get_model_id() { fi } +# run JSON.sh +JSONsh() { + "$ROOT"/shinc/JSON.sh +} +# workaround for https://github.com/dominictarr/JSON.sh/issues/50 +[ -x "$ROOT"/egrep ] && PATH="$ROOT:$PATH" && export PATH + # perform an inform request # use netcat instead of wget, because busybox misses wget's --post-file argument inform_request() { diff --git a/src/unifi-inform-process b/src/unifi-inform-process index 113f992..82decc9 100755 --- a/src/unifi-inform-process +++ b/src/unifi-inform-process @@ -12,7 +12,7 @@ INTERVAL_TMPFILE=/tmp/unifi-inform-process_interval.tmp export CFG_DIR INTERVAL_TMPFILE -"$ROOT"/shinc/JSON.sh -l | awk ' +JSONsh -l | awk ' /^\["_type"\]/ { TYPE = $2 } diff --git a/src/unifi-inform-status b/src/unifi-inform-status index c8a7482..9e2d148 100755 --- a/src/unifi-inform-status +++ b/src/unifi-inform-status @@ -33,7 +33,7 @@ export CFGVERSION MODEL ( # the status JSON converted to single lines - toughswitch_status | "$ROOT"/shinc/JSON.sh -l + toughswitch_status | JSONsh -l # and port names from the system configuration toughswitch_config | grep '^switch\.port\.[0-9]\+\.name=' ) | awk '