Message ID | 1497049152-38454-1-git-send-email-freifunk@adrianschmutzler.de |
---|---|
State | Accepted |
Headers | show |
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 92bdbc6..3fb28c5 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 + %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> @@ -47,3 +63,13 @@ HOSTNAME=$(uci -q get 'system.@system[0].hostname') <div id="container"> <div id="primarycontainer"> <div id="primarycontent"> + <% + if [ -s /tmp/isupdate ] ; then + VERSION=$(cat /tmp/isupdate) + %> + <table style="width: 100%;"> + <tr> + <td><span style="font-size: 16pt; color:#FF0000">Es ist eine neue Firmware für deinen Freifunkrouter verfügbar.<br />Alte Version: <%= ${FIRMWARE_VERSION} %> - Neue Version: <%= ${VERSION} %> <br /><a href="upgrade.html">Firmware jetzt updaten</a></span></td> + </tr> + </table> + <% fi %>
Hi, Reviewed-by: Michael Fritscher <fff@mifritscher.de> Viele Grüße, Michael Fritscher > 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 <freifunk@adrianschmutzler.de> > > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > 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 92bdbc6..3fb28c5 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 > + > %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > @@ -47,3 +63,13 @@ HOSTNAME=$(uci -q get 'system.@system[0].hostname') > <div id="container"> > <div id="primarycontainer"> > <div id="primarycontent"> > + <% > + if [ -s /tmp/isupdate ] ; then > + VERSION=$(cat /tmp/isupdate) > + %> > + <table style="width: 100%;"> > + <tr> > + <td><span style="font-size: 16pt; color:#FF0000">Es ist eine neue > Firmware für deinen Freifunkrouter verfügbar.<br />Alte Version: <%= > ${FIRMWARE_VERSION} %> - Neue Version: <%= ${VERSION} %> <br /><a > href="upgrade.html">Firmware jetzt updaten</a></span></td> > + </tr> > + </table> > + <% fi %>
Hi, Am 10.06.2017 um 00:59 schrieb Adrian Schmutzler: > +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 wget sollte im PATH sein - das müsste auch ohne /usr/bin funktionieren. Grüße, Dominik
Es gibt zwei wget (seit dem Umstieg auf LEDE!, nicht bei 20170110), einmal das in Busybox integrierte (/usr/bin/wget) und einmal das "volle" wget 1.18 (/bin/wget). Letzteres hat einen Bug, sodass IPv6 Local-Link-Adressen nicht funktionieren: https://bugs.launchpad.net/ubuntu/+source/wget/+bug/1566930 Entsprechend funktioniert der Code, wenn du ihn ins Terminal eingibst, problemlos (da hier die erstere wget executable verwendet wird). Im WebUI wird aber (warum auch immer), die andere Executable verwendet, und es gibt einen Fehler (wenn man stdout und stderr abfängt). Hat etwas gedauert, bis ich das rausgefunden habe ;-), aber nur wenn ich die Busybox executable einfüge (also /usr/bin/wget), läuft der Code. Wer es nicht glaubt, kann im Terminal (nur mit der alpha Firmware, siehe oben) die beiden Executables aufrufen und damit experimentieren: /usr/bin/wget http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current/release.nfo -P /tmp /bin/wget http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current/release.nfo -P /tmp Grüße Adrian -----Original Message----- From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf Of Dominik Heidler Sent: Freitag, 16. Juni 2017 12:39 To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-dev@freifunk.net Subject: Re: [PATCH v4 1/2] WebUI: Show firmware update notification in WebUI Hi, Am 10.06.2017 um 00:59 schrieb Adrian Schmutzler: > +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 wget sollte im PATH sein - das müsste auch ohne /usr/bin funktionieren. Grüße, Dominik -- franken-dev mailing list franken-dev@freifunk.net http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Hi Der Patch lag auch noch rum.. Ist jetzt applied. Tim Am Samstag, den 10.06.2017, 00:59 +0200 schrieb Adrian Schmutzler: > 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 <freifunk@adrianschmutzler.de> > > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > 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 92bdbc6..3fb28c5 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 > + > %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > @@ -47,3 +63,13 @@ HOSTNAME=$(uci -q get 'system.@system[0].hostname') > <div id="container"> > <div id="primarycontainer"> > <div id="primarycontent"> > + <% > + if [ -s /tmp/isupdate ] ; then > + VERSION=$(cat /tmp/isupdate) > + %> > + <table style="width: 100%;"> > + <tr> > + <td><span style="font-size: 16pt; color:#FF0000">Es ist eine neue Firmware für deinen Freifunkrouter verfügbar.<br />Alte Version: <%= ${FIRMWARE_VERSION} %> - Neue Version: <%= ${VERSION} %> <br /><a href="upgrade.html">Firmware jetzt updaten</a></span></td> > + </tr> > + </table> > + <% fi %> > -- > 2.7.4 >