[Alternative,1/2] fff-hoodutils: Adjust upgrade path function for changed folder structure

Submitted by Fabian Blaese on Nov. 20, 2019, 9:27 p.m.

Details

Message ID 20191120212745.11802-1-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese Nov. 20, 2019, 9:27 p.m.
As we now have multiple variants, the binaries on the update server
should be seperated into different directories.

To allow the firmware to decide which variant it wants to download,
the "$VARIANT/current" part is removed from the hoodfiles. Instead
it is added inside the upgrade path function in fff-hoodutils.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 .../fff/fff-hoodutils/files/lib/functions/fff/keyxchange  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
index a18926e..faaa85f 100644
--- a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
+++ b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
@@ -2,6 +2,7 @@ 
 # License GPLv3
 
 . /usr/share/libubox/jshn.sh
+. /etc/firmware_release
 
 hoodfiletmp="/tmp/hoodfile"
 hoodfileref="/tmp/hoodfileref"
@@ -21,14 +22,19 @@  getJsonPath() {
 
 getUpgradePath() {
 	jsonfile="$(getJsonPath)"
+	local upgrade_path
 
 	if [ -n "$jsonfile" ] ; then
 		json_load "$(cat "$jsonfile")"
 		json_select hood
 		json_get_var upath upgrade_path
-		echo "$upath"
+		upgrade_path="$upath"
 	else
 		return 1
 	fi
+
+	# add full firmware path for current firmwares variant
+	echo "${upgrade_path}/${VARIANT}/current"
+
 	return 0
 }

Comments

Adrian Schmutzler Nov. 22, 2019, 2:20 p.m.
Sieht beides richtig aus.

Für nen richtigen Review brauch ich aber noch mal mehr Zeit.

Wenn du es eilig hast, musst du aber nicht warten.

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Mittwoch, 20. November 2019 22:28
> To: franken-dev@freifunk.net
> Subject: [Alternative PATCH 1/2] fff-hoodutils: Adjust upgrade path function
> for changed folder structure
> 
> As we now have multiple variants, the binaries on the update server should
> be seperated into different directories.
> 
> To allow the firmware to decide which variant it wants to download, the
> "$VARIANT/current" part is removed from the hoodfiles. Instead it is added
> inside the upgrade path function in fff-hoodutils.
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  .../fff/fff-hoodutils/files/lib/functions/fff/keyxchange  | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> index a18926e..faaa85f 100644
> --- a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> +++ b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
> @@ -2,6 +2,7 @@
>  # License GPLv3
> 
>  . /usr/share/libubox/jshn.sh
> +. /etc/firmware_release
> 
>  hoodfiletmp="/tmp/hoodfile"
>  hoodfileref="/tmp/hoodfileref"
> @@ -21,14 +22,19 @@ getJsonPath() {
> 
>  getUpgradePath() {
>  	jsonfile="$(getJsonPath)"
> +	local upgrade_path
> 
>  	if [ -n "$jsonfile" ] ; then
>  		json_load "$(cat "$jsonfile")"
>  		json_select hood
>  		json_get_var upath upgrade_path
> -		echo "$upath"
> +		upgrade_path="$upath"
>  	else
>  		return 1
>  	fi
> +
> +	# add full firmware path for current firmwares variant
> +	echo "${upgrade_path}/${VARIANT}/current"
> +
>  	return 0
>  }
> --
> 2.24.0
Christian Dresel Nov. 23, 2019, 10:21 a.m.
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Fabian Blaese Nov. 23, 2019, 1:30 p.m.
beide applied und passende rewrites auf dem Updateserver gebaut.