From: Jo-Philipp Wich Date: Thu, 13 Feb 2014 21:19:00 +0000 (+0000) Subject: ar71xx: fix mtdpartsize macro in image Makefile (#14961) X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=d53363d917db3cfeac537032694df99cc5f64e4a ar71xx: fix mtdpartsize macro in image Makefile (#14961) The mtdpartsize macro triggers shell errors on various Linux distributions when the partname argument $(1) does not appear within the partmap $(2). Change the sed pattern to only emit anything if a successful substitution occured and only evaluate the arithmetic expression if something was printed by the sed program. Signed-off-by: Jo-Philipp Wich SVN-Revision: 39583 --- diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 1f181f4ce2..9076f22ff0 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -36,7 +36,7 @@ $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3)) endef define mtdpartsize -$(shell echo $$((`echo '$(2)' | sed -e 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/'` * 1024))) +$(shell sz=`echo '$(2)' | sed -ne 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/p'`; [ -n "$$sz" ] && echo $$(($$sz * 1024))) endef SINGLE_PROFILES:=