From 2caf86d9464c3834af443fd857e9149ef59ef754 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 10 Jun 2017 00:59:12 +0200 Subject: [PATCH] WebUI: Show firmware update notification in WebUI Displays update notification for user, but does not provide automatic updates. Version comparison is based on string match, so build dates are not relevant. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler Reviewed-by: Michael Fritscher --- src/packages/fff/fff-web/Makefile | 2 +- .../fff/fff-web/files/www/ssl/cgi-bin/header | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile index 5772f87..723d9a9 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:=0.0.3 +PKG_VERSION:=0.0.4 PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/fff-web 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 55ab6ce..8df0ed0 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 @@ -1,6 +1,8 @@ #!/usr/bin/haserl <% +. /etc/community.cfg +. /etc/firmware_release echo -en "Content-Type: text/html\r\n\r\n" nav_entry() { script_file="/cgi-bin/$1" @@ -12,6 +14,20 @@ nav_entry() { HOSTNAME=$(uci -q get 'system.@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 + 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 + %> @@ -47,3 +63,13 @@ HOSTNAME=$(uci -q get 'system.@system[0].hostname')
+ <% + if [ -s /tmp/isupdate ] ; then + VERSION=$(cat /tmp/isupdate) + %> + + + + +
Es ist eine neue Firmware für deinen Freifunkrouter verfügbar.
Alte Version: <%= ${FIRMWARE_VERSION} %> - Neue Version: <%= ${VERSION} %>
Firmware jetzt updaten
+ <% fi %>