From patchwork Fri Jul 21 13:08:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,v4,06/11] fff-web: Added options to disable update notification From: Adrian Schmutzler X-Patchwork-Id: 399 Message-Id: <1500642529-3627-7-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Fri, 21 Jul 2017 15:08:44 +0200 Update notification is enabled by default. If required, this allows disabling it either until next firmware upgrade or permanently. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler --- src/packages/fff/fff-web/Makefile | 2 +- .../files/etc/uci-defaults/06-fff-reset-update-notification | 9 +++++++++ .../fff-web/files/usr/sbin/disable_update_notification.sh | 12 ++++++++++++ src/packages/fff/fff-web/files/www/ssl/cgi-bin/header | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/packages/fff/fff-web/files/etc/uci-defaults/06-fff-reset-update-notification 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 906bf49..9c6b68b 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)/fff-web diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/06-fff-reset-update-notification b/src/packages/fff/fff-web/files/etc/uci-defaults/06-fff-reset-update-notification new file mode 100644 index 0000000..4d270b4 --- /dev/null +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/06-fff-reset-update-notification @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(uci -q get fff.notifyupdate.resetonupgrade)" = "1" ] ; then + uci -q set "fff.notifyupdate.value=1" + uci -q commit fff + /bin/rm -f /tmp/fwcheck +fi + +exit 0 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..65b02e0 --- /dev/null +++ b/src/packages/fff/fff-web/files/usr/sbin/disable_update_notification.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This disables the WebUI update notification permanently +# (until next firmware upgrade) + +uci -q set "fff.notifyupdate=webui" +uci -q set "fff.notifyupdate.value=0" +uci -q set "fff.notifyupdate.resetonupgrade=1" + +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 dffca6d..775133d 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 @@ -16,7 +16,7 @@ HOSTNAME=$(uci -q get 'fff.@system[0].hostname') NOW=$(date +%s) #Check if new Firmware check older then 1 day -if [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] ; then +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