[OpenWrt-Devel] [PATCH] package/boot/uboot-envtools: retry uci-defaults on empty config

Tijs Van Buggenhout tvb at able.be
Mon Oct 27 09:11:40 EDT 2014


Consider an OpenWRT release for a certain board without support for
uboot(-envtools). An empty config file /etc/config/uboot-env is created.

Consider a new OpenWRT release with support for uboot(-envtools) added for
that board. If the uci config was preserved over sysupgrade (the default), the
/etc/config/uboot-env is restored at first boot and uci-defaults for
uboot-envtools skips any processing, as a config already exists, failing to
update the config with newly supported configuration for that board.

The following patch retries uci-defaults for uboot-envtools at first boot
(e.g. after sysupgrade) whenever an empty uci config file is found.

Signed-off-by: Tijs Van Buggenhout <tvb at able.be>

--

diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx
index f660883..8d64d43 100644
--- a/package/boot/uboot-envtools/files/ar71xx
+++ b/package/boot/uboot-envtools/files/ar71xx
@@ -3,7 +3,7 @@
 # Copyright (C) 2011-2014 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/cns3xxx b/package/boot/uboot-envtools/files/cns3xxx
index a56be15..70521ed 100644
--- a/package/boot/uboot-envtools/files/cns3xxx
+++ b/package/boot/uboot-envtools/files/cns3xxx
@@ -3,7 +3,7 @@
 # Copyright (C) 2013 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/imx6 b/package/boot/uboot-envtools/files/imx6
index fac6436..a63c8ae 100644
--- a/package/boot/uboot-envtools/files/imx6
+++ b/package/boot/uboot-envtools/files/imx6
@@ -3,7 +3,7 @@
 # Copyright (C) 2013-2014 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood
index ef6c113..ec32ec0 100644
--- a/package/boot/uboot-envtools/files/kirkwood
+++ b/package/boot/uboot-envtools/files/kirkwood
@@ -3,7 +3,7 @@
 # Copyright (C) 2012-2014 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/lantiq b/package/boot/uboot-envtools/files/lantiq
index 69b375d..79526c0 100644
--- a/package/boot/uboot-envtools/files/lantiq
+++ b/package/boot/uboot-envtools/files/lantiq
@@ -3,7 +3,7 @@
 # Copyright (C) 2012 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu
index 1b1f5ff..bfec1e5 100644
--- a/package/boot/uboot-envtools/files/mvebu
+++ b/package/boot/uboot-envtools/files/mvebu
@@ -3,7 +3,7 @@
 # Copyright (C) 2014 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/mxs b/package/boot/uboot-envtools/files/mxs
index ab8b4ef..ee66e8e 100644
--- a/package/boot/uboot-envtools/files/mxs
+++ b/package/boot/uboot-envtools/files/mxs
@@ -3,7 +3,7 @@
 # Copyright (C) 2013 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 1ab6148..6dffbb6 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -3,7 +3,7 @@
 # Copyright (C) 2011-2012 OpenWrt.org
 #
 
-[ -e /etc/config/ubootenv ] && exit 0
+[ -s /etc/config/ubootenv ] && exit 0
 
 touch /etc/config/ubootenv
 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list