fff-sysupgrade: replace comma by underscore in image file names

Submitted by Adrian Schmutzler on April 1, 2020, 10:24 a.m.

Details

Message ID 20200401102459.1345-1-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler April 1, 2020, 10:24 a.m.
On modern targets in OpenWrt, the board name follows the
"vendor,model" syntax. Since commas in file names are uncommon
and ugly, file names use the same pattern with an underscore,
"vendor_model".

Since this also applies to image file names, this patch
adjusts fff-upgrade.sh to replace the comma from board name
by an underscore for all devices. This should be possible
without harm as OpenWrt images can safely be expected to
either contain a comma in the right place or no comma at all.

It has been discussed whether the same should be applied to
the network.* files as well. However, expecting those to
be removed in the foreseeable future does make this undesirable,
as a lot of code would be inserted now and be removed again a few
months later, only to fix the name for one device.

For the same reason, we won't touch the board name replace
for the TL-WDR4900 v1 for now.

Suggested-by: Fabian Bläse <fabian@blaese.de>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

---

This replaces the patch "treewide: use underscore for device identifier in file names"
---
 src/packages/fff/fff-sysupgrade/Makefile                  | 2 +-
 src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
index 0f2e6a1e..e88b51d4 100644
--- a/src/packages/fff/fff-sysupgrade/Makefile
+++ b/src/packages/fff/fff-sysupgrade/Makefile
@@ -1,7 +1,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-sysupgrade
-PKG_RELEASE:=11
+PKG_RELEASE:=12
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 
diff --git a/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh b/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
index 2b749f3b..1064beb6 100755
--- a/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
+++ b/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
@@ -12,7 +12,7 @@  if [ -z "$UPGRADE_PATH" ]; then
   exit 1
 fi
 
-BOARD=$(uci get board.model.name)
+BOARD=$(uci get board.model.name | sed 's/,/_/')
 
 echo "Hardware: $BOARD"
 

Comments

Fabian Blaese April 1, 2020, 10:38 a.m.
Reviewed-by: Fabian Bläse <fabian@blaese.de>

Gruß
Fabian

On 01.04.20 12:24, Adrian Schmutzler wrote:
> On modern targets in OpenWrt, the board name follows the
> "vendor,model" syntax. Since commas in file names are uncommon
> and ugly, file names use the same pattern with an underscore,
> "vendor_model".
> 
> Since this also applies to image file names, this patch
> adjusts fff-upgrade.sh to replace the comma from board name
> by an underscore for all devices. This should be possible
> without harm as OpenWrt images can safely be expected to
> either contain a comma in the right place or no comma at all.
> 
> It has been discussed whether the same should be applied to
> the network.* files as well. However, expecting those to
> be removed in the foreseeable future does make this undesirable,
> as a lot of code would be inserted now and be removed again a few
> months later, only to fix the name for one device.
> 
> For the same reason, we won't touch the board name replace
> for the TL-WDR4900 v1 for now.
> 
> Suggested-by: Fabian Bläse <fabian@blaese.de>
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> ---
> 
> This replaces the patch "treewide: use underscore for device identifier in file names"
> ---
>  src/packages/fff/fff-sysupgrade/Makefile                  | 2 +-
>  src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
> index 0f2e6a1e..e88b51d4 100644
> --- a/src/packages/fff/fff-sysupgrade/Makefile
> +++ b/src/packages/fff/fff-sysupgrade/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-sysupgrade
> -PKG_RELEASE:=11
> +PKG_RELEASE:=12
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>  
> diff --git a/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh b/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
> index 2b749f3b..1064beb6 100755
> --- a/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
> +++ b/src/packages/fff/fff-sysupgrade/files/sbin/fff-upgrade.sh
> @@ -12,7 +12,7 @@ if [ -z "$UPGRADE_PATH" ]; then
>    exit 1
>  fi
>  
> -BOARD=$(uci get board.model.name)
> +BOARD=$(uci get board.model.name | sed 's/,/_/')
>  
>  echo "Hardware: $BOARD"
>  
>
Adrian Schmutzler April 2, 2020, 11:13 a.m.
Applied.