[v11,3/6] fff-web: Added options to disable update notification

Submitted by Adrian Schmutzler on Oct. 18, 2017, 9:30 p.m.

Details

Message ID 1508362258-8918-3-git-send-email-freifunk@adrianschmutzler.de
State Superseded
Headers show

Commit Message

Adrian Schmutzler Oct. 18, 2017, 9:30 p.m.
Update notification is enabled by default. If required, this
allows disabling it either until next firmware upgrade or
permanently.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 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

Patch hide | download patch | download mbox

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/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 f98a3f3..42a5760 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,7 +17,7 @@  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
+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

Comments

Tim Niemeyer Nov. 2, 2017, 10:26 p.m.
Hi

Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> Update notification is enabled by default. If required, this
> allows disabling it either until next firmware upgrade or
> permanently.
Es wird einfacher zu verstehen, wenn es einfach ein permanentes Setting
ist.

> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  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 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/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
Auf das resetonupgrade würde ich gern verzichten.

> +	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
Permanent.. Ok.
> +# (until next firmware upgrade)
Also doch nicht permanent..

> +
> +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 f98a3f3..42a5760 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,7 +17,7 @@ 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
> +if ( [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] ) && [ ! "$(uci -q get fff.notifyupdate.value)" = "0" ] ; then

Es reicht völlig das Setting fff.notifyupdate.value zu prüfen. Das
rücksetzen usw einfach weglassen.

Tim

>          rm -f /tmp/isupdate
>          NEXTUPDATE=$(($(date +%s)+86400))
>          echo $NEXTUPDATE > /tmp/fwcheck
> -- 
> 2.7.4
>
Adrian Schmutzler Nov. 3, 2017, 1:41 p.m.
Hallo Tim,

ich bin zwar weiterhin ein Fan des resetonupgrade, werde das aber jetzt erstmal rausschmeißen und dann irgendwann nochmal einzeln als Patch anbieten. So kommen wir erstmal voran ...

Grüße

Adrian

> -----Original Message-----
> From: Tim Niemeyer [mailto:tim@tn-x.org]
> Sent: Donnerstag, 2. November 2017 23:26
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
> dev@freifunk.net
> Subject: Re: [PATCH v11 3/6] fff-web: Added options to disable update
> notification
> 
> Hi
> 
> Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> > Update notification is enabled by default. If required, this allows
> > disabling it either until next firmware upgrade or permanently.
> Es wird einfacher zu verstehen, wenn es einfach ein permanentes Setting ist.
> 
> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> >
> > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> > ---
> >  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-no
> > tification  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/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-upd
> > +++ ate-notification
> > @@ -0,0 +1,9 @@
> > +#!/bin/sh
> > +
> > +if [ "$(uci -q get fff.notifyupdate.resetonupgrade)" = "1" ] ; then
> Auf das resetonupgrade würde ich gern verzichten.
> 
> > +	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_notificat
> > +++ ion.sh
> > @@ -0,0 +1,12 @@
> > +#!/bin/sh
> > +# This disables the WebUI update notification permanently
> Permanent.. Ok.
> > +# (until next firmware upgrade)
> Also doch nicht permanent..
> 
> > +
> > +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 f98a3f3..42a5760 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,7 +17,7 @@ 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
> > +if ( [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW" ] )
> > +&& [ ! "$(uci -q get fff.notifyupdate.value)" = "0" ] ; then
> 
> Es reicht völlig das Setting fff.notifyupdate.value zu prüfen. Das rücksetzen
> usw einfach weglassen.
> 
> Tim
> 
> >          rm -f /tmp/isupdate
> >          NEXTUPDATE=$(($(date +%s)+86400))
> >          echo $NEXTUPDATE > /tmp/fwcheck
> > --
> > 2.7.4
> >
Tim Niemeyer Nov. 3, 2017, 1:44 p.m.
Am Freitag, den 03.11.2017, 14:41 +0100 schrieb Adrian Schmutzler:
> Hallo Tim,
> 
> ich bin zwar weiterhin ein Fan des resetonupgrade, werde das aber
> jetzt erstmal rausschmeißen und dann irgendwann nochmal einzeln als
> Patch anbieten. So kommen wir erstmal voran ...
Ok, danke dir.

In mehreren Häppchen ist es vielleicht besser zu verdauen. ;)

Tim

> Grüße
> 
> Adrian
> 
> > -----Original Message-----
> > From: Tim Niemeyer [mailto:tim@tn-x.org]
> > Sent: Donnerstag, 2. November 2017 23:26
> > To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
> > dev@freifunk.net
> > Subject: Re: [PATCH v11 3/6] fff-web: Added options to disable
> > update
> > notification
> > 
> > Hi
> > 
> > Am Mittwoch, den 18.10.2017, 23:30 +0200 schrieb Adrian Schmutzler:
> > > Update notification is enabled by default. If required, this
> > > allows
> > > disabling it either until next firmware upgrade or permanently.
> > 
> > Es wird einfacher zu verstehen, wenn es einfach ein permanentes
> > Setting ist.
> > 
> > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> > > 
> > > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> > > ---
> > >  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-no
> > > tification  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/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-upd
> > > +++ ate-notification
> > > @@ -0,0 +1,9 @@
> > > +#!/bin/sh
> > > +
> > > +if [ "$(uci -q get fff.notifyupdate.resetonupgrade)" = "1" ] ;
> > > then
> > 
> > Auf das resetonupgrade würde ich gern verzichten.
> > 
> > > +	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_notificat
> > > +++ ion.sh
> > > @@ -0,0 +1,12 @@
> > > +#!/bin/sh
> > > +# This disables the WebUI update notification permanently
> > 
> > Permanent.. Ok.
> > > +# (until next firmware upgrade)
> > 
> > Also doch nicht permanent..
> > 
> > > +
> > > +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 f98a3f3..42a5760 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,7 +17,7 @@ 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
> > > +if ( [ ! -s /tmp/fwcheck ] || [ "$(cat /tmp/fwcheck)" -lt "$NOW"
> > > ] )
> > > +&& [ ! "$(uci -q get fff.notifyupdate.value)" = "0" ] ; then
> > 
> > Es reicht völlig das Setting fff.notifyupdate.value zu prüfen. Das
> > rücksetzen
> > usw einfach weglassen.
> > 
> > Tim
> > 
> > >          rm -f /tmp/isupdate
> > >          NEXTUPDATE=$(($(date +%s)+86400))
> > >          echo $NEXTUPDATE > /tmp/fwcheck
> > > --
> > > 2.7.4
> > > 
> 
>