[PATCH v12 3/5] fff-web: Added options to disable update notification
Tim Niemeyer
tim at tn-x.org
So Nov 12 20:08:08 CET 2017
Hi
Reviewed-by: Tim Niemeyer <tim at tn-x.org>
Tim
Am Freitag, den 03.11.2017, 15:00 +0100 schrieb Adrian Schmutzler:
> Update notification is enabled by default. If required, this
> allows disabling it permanently.
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>
> Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>
> ---
>
> 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. at 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
>
> %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> @@ -35,9 +35,9 @@ fi
> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
> <title><%= ${HOSTNAME} %></title>
> <link href="/style.css" rel="stylesheet" type="text/css" media="screen" />
> - <meta http-equiv="cache-control" content="no-cache" />
> - <meta http-equiv="pragma" content="no-cache" />
> - <meta http-equiv="expires" content="0" />
> + <meta http-equiv="cache-control" content="no-cache" />
> + <meta http-equiv="pragma" content="no-cache" />
> + <meta http-equiv="expires" content="0" />
> </head>
> <body>
> <div id="header" style="position: relative;">
> --
> 2.7.4
>
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname : signature.asc
Dateityp : application/pgp-signature
Dateigröße : 473 bytes
Beschreibung: This is a digitally signed message part
URL : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171112/982ca7b2/attachment.sig>
Mehr Informationen über die Mailingliste franken-dev