Message ID | 1528900566-9555-4-git-send-email-freifunk@adrianschmutzler.de |
---|---|
State | Superseded |
Headers | show |
diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index baee487..1c1eda7 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -12,8 +12,10 @@ sectorfiletmp=/tmp/sectorfile sectorfilewww=/www/hood/sectorfile hoodfilelocal=/etc/hoodfile +hoodfileisauth=/tmp/hoodfileisauth rm -f "$hoodfiletmp" +rm -f "$hoodfileisauth" # auth file is associated with hoodfiletmp, so delete it here, too # Gatewaycheck function isGatewayAvailable() { @@ -77,7 +79,7 @@ if [ -s "$hoodfilelocal" ]; then else # if we have Internet, we download the Hoodfile from the keyxchangev2 if hasInternet ; then - getKeyserverHoodfile "$hoodfiletmp" + getKeyserverHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" rm -f "$sectorfiletmp" [ -s "$sectorfilelocal" ] || rm -f "$sectorfilewww" # If internet present, no custom config should be distributed, except when local file is present @@ -108,7 +110,7 @@ else fi else echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1" - getGatewayHoodfile "$hoodfiletmp" + getGatewayHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" #UPLINK: Do nothing fi fi @@ -215,7 +217,7 @@ if [ -s "$hoodfiletmp" ]; then # copy the file to webroot so that other mesh routers can download it; # copy only after all other steps so IF can be reentered if something goes wrong cp "$hoodfiletmp" "$hoodfileref" - cp "$hoodfiletmp" "$hoodfilewww" + [ -f "$hoodfileisauth" ] && cp "$hoodfiletmp" "$hoodfilewww" [ -s "$sectorfiletmp" ] && cp "$sectorfiletmp" "$sectorfilewww" # This is a workaround to enable alfred on devices which do not see a configap during initial setup
Moin, das macht glaub ich ganz fiese Randfälle: Das File wird jetzt nämlich nur noch kopiert, wenn es direkt vom Gateway/Keyxchange stammte. Wird mit einem Wifi/Ethernet Hoodfile konfiguriert, welches mit dem Gateway/Keyxchange Hoodfile übereinstimmt, kommen wir im zweiten Durchlauf gar nicht mehr in den if-Zweig, in dem die Datei nach /www kopiert wird, weil die Checksum identisch ist. Abgesehen davon mag ich irgendwie das parallel zum hoodfiletmp existierende hoodfileisauth nicht. Wäre es nicht einfacher - da wir ja jetzt eine getrennte Datei für das Checksumming haben - das Hoodfile gleich nach /www zu kopieren, wenn wir es (erfolgreich) von Keyxchange oder Gateway geladen haben? Gruß Fabian > On 13. Jun 2018, at 16:36, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote: > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > index baee487..1c1eda7 100755 > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > @@ -12,8 +12,10 @@ sectorfiletmp=/tmp/sectorfile > sectorfilewww=/www/hood/sectorfile > > hoodfilelocal=/etc/hoodfile > +hoodfileisauth=/tmp/hoodfileisauth > > rm -f "$hoodfiletmp" > +rm -f "$hoodfileisauth" # auth file is associated with hoodfiletmp, so delete it here, too > > # Gatewaycheck function > isGatewayAvailable() { > @@ -77,7 +79,7 @@ if [ -s "$hoodfilelocal" ]; then > else > # if we have Internet, we download the Hoodfile from the keyxchangev2 > if hasInternet ; then > - getKeyserverHoodfile "$hoodfiletmp" > + getKeyserverHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" > > rm -f "$sectorfiletmp" > [ -s "$sectorfilelocal" ] || rm -f "$sectorfilewww" # If internet present, no custom config should be distributed, except when local file is present > @@ -108,7 +110,7 @@ else > fi > else > echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1" > - getGatewayHoodfile "$hoodfiletmp" > + getGatewayHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" > #UPLINK: Do nothing > fi > fi > @@ -215,7 +217,7 @@ if [ -s "$hoodfiletmp" ]; then > # copy the file to webroot so that other mesh routers can download it; > # copy only after all other steps so IF can be reentered if something goes wrong > cp "$hoodfiletmp" "$hoodfileref" > - cp "$hoodfiletmp" "$hoodfilewww" > + [ -f "$hoodfileisauth" ] && cp "$hoodfiletmp" "$hoodfilewww" > [ -s "$sectorfiletmp" ] && cp "$sectorfiletmp" "$sectorfilewww" > > # This is a workaround to enable alfred on devices which do not see a configap during initial setup > -- > 2.7.4 >
Hallo Fabian, siehe unten. > -----Original Message----- > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf > Of Fabian Bläse > Sent: Sonntag, 24. Juni 2018 11:27 > To: Adrian Schmutzler <freifunk@adrianschmutzler.de> > Cc: franken-dev <franken-dev@freifunk.net> > Subject: Re: [PATCH 3/4] configurehood: Only provide hood file from > GW/KeyXchange via WWW > > Moin, > > das macht glaub ich ganz fiese Randfälle: > Das File wird jetzt nämlich nur noch kopiert, wenn es direkt vom > Gateway/Keyxchange stammte. Wird mit einem Wifi/Ethernet Hoodfile > konfiguriert, welches mit dem Gateway/Keyxchange Hoodfile > übereinstimmt, kommen wir im zweiten Durchlauf gar nicht mehr in den if- > Zweig, in dem die Datei nach /www kopiert wird, weil die Checksum > identisch ist. Ja, habe ich übersehen. > > Abgesehen davon mag ich irgendwie das parallel zum hoodfiletmp > existierende hoodfileisauth nicht. > > Wäre es nicht einfacher - da wir ja jetzt eine getrennte Datei für das > Checksumming haben - das Hoodfile gleich nach /www zu kopieren, wenn > wir es (erfolgreich) von Keyxchange oder Gateway geladen haben? Ja, ist wohl besser, da ja ohne den w2config erstmal nichts passiert. Allerdings würde dann nicht mehr überprüft, ob die Konfiguration geklappt hat. Evtl. könnte man beim if für den w2config noch einen Check ergänzen, ob das checksumfile erstellt wurde: if [ -s "$hoodfilewww" ] && [ -s "$hoodfileref" ] && isGatewayAvailable ; then Grüße Adrian > > Gruß > Fabian > > > On 13. Jun 2018, at 16:36, Adrian Schmutzler > <freifunk@adrianschmutzler.de> wrote: > > > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > > --- > > src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > > index baee487..1c1eda7 100755 > > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > > @@ -12,8 +12,10 @@ sectorfiletmp=/tmp/sectorfile > > sectorfilewww=/www/hood/sectorfile > > > > hoodfilelocal=/etc/hoodfile > > +hoodfileisauth=/tmp/hoodfileisauth > > > > rm -f "$hoodfiletmp" > > +rm -f "$hoodfileisauth" # auth file is associated with hoodfiletmp, > > +so delete it here, too > > > > # Gatewaycheck function > > isGatewayAvailable() { > > @@ -77,7 +79,7 @@ if [ -s "$hoodfilelocal" ]; then else > > # if we have Internet, we download the Hoodfile from the > keyxchangev2 > > if hasInternet ; then > > - getKeyserverHoodfile "$hoodfiletmp" > > + getKeyserverHoodfile "$hoodfiletmp" && touch > "$hoodfileisauth" > > > > rm -f "$sectorfiletmp" > > [ -s "$sectorfilelocal" ] || rm -f "$sectorfilewww" # If internet > > present, no custom config should be distributed, except when local file is > present @@ -108,7 +110,7 @@ else > > fi > > else > > echo "We have a Gateway in Range, we load the > keyxchangev2data from fe80::1" > > - getGatewayHoodfile "$hoodfiletmp" > > + getGatewayHoodfile "$hoodfiletmp" && touch > "$hoodfileisauth" > > #UPLINK: Do nothing > > fi > > fi > > @@ -215,7 +217,7 @@ if [ -s "$hoodfiletmp" ]; then > > # copy the file to webroot so that other mesh routers can > download it; > > # copy only after all other steps so IF can be reentered if > something goes wrong > > cp "$hoodfiletmp" "$hoodfileref" > > - cp "$hoodfiletmp" "$hoodfilewww" > > + [ -f "$hoodfileisauth" ] && cp "$hoodfiletmp" > "$hoodfilewww" > > [ -s "$sectorfiletmp" ] && cp "$sectorfiletmp" > "$sectorfilewww" > > > > # This is a workaround to enable alfred on devices which do > not see > > a configap during initial setup > > -- > > 2.7.4 > >
> On 24. Jun 2018, at 19:59, Adrian Schmutzler <mail@adrianschmutzler.de> wrote: > > Allerdings würde dann nicht mehr überprüft, ob die Konfiguration geklappt hat. Das dürfte aber auch gar nicht nötig sein, denn das File stammt vom Gateway und das ist zu dem Zeitpunkt dann auch erreichbar gewesen. Ist es danach nicht mehr erreichbar, verschwindet die Datei. Müsste passen. Gruß Fabian
Okay, klingt vernünftig und ist einfach. > -----Original Message----- > From: Fabian Bläse [mailto:fabian@blaese.de] > Sent: Sonntag, 24. Juni 2018 21:37 > To: Adrian Schmutzler <mail@adrianschmutzler.de> > Cc: franken-dev@freifunk.net > Subject: Re: [PATCH 3/4] configurehood: Only provide hood file from > GW/KeyXchange via WWW > > > > On 24. Jun 2018, at 19:59, Adrian Schmutzler <mail@adrianschmutzler.de> > wrote: > > > > Allerdings würde dann nicht mehr überprüft, ob die Konfiguration geklappt > hat. > > Das dürfte aber auch gar nicht nötig sein, denn das File stammt vom Gateway > und das ist zu dem Zeitpunkt dann auch erreichbar gewesen. Ist es danach > nicht mehr erreichbar, verschwindet die Datei. Müsste passen. > > Gruß > Fabian
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> --- src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)