aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorImran Khan <gururug@gmail.com>2019-12-17 05:59:28 -0800
committerDaniel Golle <daniel@makrotopia.org>2019-12-17 19:35:16 +0200
commit27d69d25612e857268492678b86aa88e8ea924ac (patch)
treec273cee746c336642abeb4a0836c045bc8d1cc2c
parentf45a16dead15169f06a999f71061e66df1fc478c (diff)
downloadupstream-27d69d25612e857268492678b86aa88e8ea924ac.tar.gz
upstream-27d69d25612e857268492678b86aa88e8ea924ac.tar.bz2
upstream-27d69d25612e857268492678b86aa88e8ea924ac.zip
uboot-envtools: check for config prior to append
In the rare event a pre-populated fw_env.config exists in the rootfs prior to firstboot, calling fw_setenv after the system has initialised will annihilate the devices environment due to two identical lines in fw_env.config. Check for existence prior to blind appendage. Signed-off-by: Imran Khan <gururug@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> [daniel@makrotopia.org: fixed patch format, improved grep, cosmetics]
-rw-r--r--package/boot/uboot-envtools/Makefile2
-rw-r--r--package/boot/uboot-envtools/files/uboot-envtools.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile
index f880698e9c..1c6b789716 100644
--- a/package/boot/uboot-envtools/Makefile
+++ b/package/boot/uboot-envtools/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uboot-envtools
PKG_DISTNAME:=u-boot
PKG_VERSION:=2019.07
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz
diff --git a/package/boot/uboot-envtools/files/uboot-envtools.sh b/package/boot/uboot-envtools/files/uboot-envtools.sh
index e21b283677..9218bc4e39 100644
--- a/package/boot/uboot-envtools/files/uboot-envtools.sh
+++ b/package/boot/uboot-envtools/files/uboot-envtools.sh
@@ -31,6 +31,6 @@ ubootenv_add_app_config() {
config_get envsize "$1" envsize
config_get secsize "$1" secsize
config_get numsec "$1" numsec
- echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config
+ grep -q "^[[:space:]]*${dev}[[:space:]]*${offset}" /etc/fw_env.config || echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config
}