Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Workaround for dominictarr/JSON.sh#50
Browse files Browse the repository at this point in the history
  • Loading branch information
wvengen committed Dec 26, 2016
1 parent 6367a8e commit 1121eba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/shinc/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/unifi-inform-process
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/unifi-inform-status
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down

0 comments on commit 1121eba

Please sign in to comment.