From 9bba4c57efeeebfb13c1d7be3038a566bebbc709 Mon Sep 17 00:00:00 2001 From: Tommy Huff Date: Tue, 25 Oct 2016 19:09:07 -0400 Subject: [PATCH] add jq to install script --- advanced/Scripts/chronometer.sh | 16 +++++----------- automated install/basic-install.sh | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 18456133..983914a2 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -14,19 +14,13 @@ #Functions############################################################################################################## #move to pihole - -if [ ! -f "/opt/pihole/jq" ] ; then - curl -s http://stedolan.github.io/jq/download/linux64/jq -o /opt/pihole/jq - chmod 755 /opt/pihole/jq -fi - statsUpdateJSON() { if [[ -z "${AdminLink}" ]] ; then AdminLink="http://127.0.0.1/admin" fi local x=$(curl -s ${AdminLink}/api.php?summaryRaw) #check if json is valid - if echo "${x}" | /opt/pihole/jq "." > /dev/null ; then + if echo "${x}" | jq "." > /dev/null ; then echo "${x}" else echo "Error" @@ -40,7 +34,7 @@ statsBlockedDomains() { fi if [[ "${json}" != "Error" ]] ; then # local x=$(echo "${json}" | python -c "import sys, json; print json.load(sys.stdin)['domains_being_blocked']") - local x=$(echo "${json}" | /opt/pihole/jq ".domains_being_blocked" | tr -d '"') + local x=$(echo "${json}" | jq ".domains_being_blocked" | tr -d '"') echo ${x} else echo "Error" @@ -53,7 +47,7 @@ statsQueriesToday() { json=$(statsUpdateJSON) fi if [[ "${json}" != "Error" ]] ; then - local x=$(echo "${json}" | /opt/pihole/jq ".dns_queries_today" | tr -d '"') + local x=$(echo "${json}" | jq ".dns_queries_today" | tr -d '"') echo ${x} else echo "Error" @@ -66,7 +60,7 @@ statsBlockedToday() { json=$(statsUpdateJSON) fi if [[ "${json}" != "Error" ]] ; then - local x=$(echo "${json}" | /opt/pihole/jq ".ads_blocked_today" | tr -d '"') + local x=$(echo "${json}" | jq ".ads_blocked_today" | tr -d '"') echo ${x} else echo "Error" @@ -79,7 +73,7 @@ statsPercentBlockedToday() { json=$(statsUpdateJSON) fi if [[ "${json}" != "Error" ]] ; then - local x=$(echo "${json}" | /opt/pihole/jq ".ads_percentage_today" | tr -d '"' | xargs printf "%.*f\n" 2) + local x=$(echo "${json}" | jq ".ads_percentage_today" | tr -d '"' | xargs printf "%.*f\n" 2) echo ${x} else echo "Error" diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index dfed93a1..d4b0d893 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -83,7 +83,7 @@ if [ -x "$(command -v apt-get)" ]; then # grep -c will return 1 retVal on 0 matches, block this throwing the set -e with an OR TRUE PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" INSTALLER_DEPS=( apt-utils whiptail git dhcpcd5) - PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd ${phpVer}-common ${phpVer}-cgi curl unzip wget sudo netcat cron iproute2 ) + PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd ${phpVer}-common ${phpVer}-cgi curl unzip wget sudo netcat cron iproute2 jq) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian"