From patchwork Fri Nov 3 14:00:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v12,3/5] fff-web: Added options to disable update notification From: Adrian Schmutzler X-Patchwork-Id: 657 Message-Id: <1509717604-3898-3-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Fri, 3 Nov 2017 15:00:02 +0100 Update notification is enabled by default. If required, this allows disabling it permanently. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler Reviewed-by: Tim Niemeyer --- Changes in v12: - Removed resetonupgrade - Harmonized indentation in cgi-bin/header --- src/packages/fff/fff-web/Makefile | 2 +- .../files/usr/sbin/disable_update_notification.sh | 11 +++++++++ .../fff/fff-web/files/www/ssl/cgi-bin/header | 26 +++++++++++----------- 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100755 src/packages/fff/fff-web/files/usr/sbin/disable_update_notification.sh diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile index d7201e2..c885218 100644 --- a/src/packages/fff/fff-web/Makefile +++ b/src/packages/fff/fff-web/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-web -PKG_VERSION:=5 +PKG_VERSION:=6 PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/src/packages/fff/fff-web/files/usr/sbin/disable_update_notification.sh b/src/packages/fff/fff-web/files/usr/sbin/disable_update_notification.sh new file mode 100755 index 0000000..737cec3 --- /dev/null +++ b/src/packages/fff/fff-web/files/usr/sbin/disable_update_notification.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# This disables the WebUI update notification permanently +# (preserved during firmware upgrade) + +uci -q set "fff.notifyupdate=webui" +uci -q set "fff.notifyupdate.value=0" + +uci -q commit fff + +/bin/rm -f /tmp/isupdate +/bin/rm -f /tmp/fwcheck diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header index f98a3f3..dbfb00a 100755 --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header @@ -17,16 +17,16 @@ hood="$(uci -q get "system.@system[0].hood")" NOW=$(date +%s) #Check if new Firmware check older then 1 day -if [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] ; then - rm -f /tmp/isupdate - NEXTUPDATE=$(($(date +%s)+86400)) - echo $NEXTUPDATE > /tmp/fwcheck - /usr/bin/wget "${UPGRADE_PATH}/release.nfo" -P /tmp -T 2 - VERSION=$(cat /tmp/release.nfo|awk -F: '/VERSION:/ { print $2 }') - rm -f /tmp/release.nfo - if [ "$VERSION" != "$FIRMWARE_VERSION" -a -n "$VERSION" ]; then - echo $VERSION > /tmp/isupdate - fi +if ( [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] ) && [ ! "$(uci -q get fff.notifyupdate.value)" = "0" ] ; then + rm -f /tmp/isupdate + NEXTUPDATE=$(($(date +%s)+86400)) + echo $NEXTUPDATE > /tmp/fwcheck + /usr/bin/wget "${UPGRADE_PATH}/release.nfo" -P /tmp -T 2 + VERSION=$(cat /tmp/release.nfo|awk -F: '/VERSION:/ { print $2 }') + rm -f /tmp/release.nfo + if [ "$VERSION" != "$FIRMWARE_VERSION" -a -n "$VERSION" ]; then + echo $VERSION > /tmp/isupdate + fi fi %> @@ -35,9 +35,9 @@ fi <%= ${HOSTNAME} %> - - - + + +