aboutsummaryrefslogtreecommitdiffstats
path: root/include/version.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-07-29 13:30:23 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-07-29 13:30:23 +0000
commit02627475b95042953a2202d420e1b3cd707d072d (patch)
treecf0dab6665c3d91ae4a30787e104f4c968b4986b /include/version.mk
parent5198a23da8047a6df214544b46a4b57a9addf8b6 (diff)
downloadupstream-02627475b95042953a2202d420e1b3cd707d072d.tar.gz
upstream-02627475b95042953a2202d420e1b3cd707d072d.tar.bz2
upstream-02627475b95042953a2202d420e1b3cd707d072d.zip
base-files: properly escape strings for version info
Make sure they don't break the sed command, and also make device_info and openwrt_release more robust for parsing by scripts Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41885 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include/version.mk')
-rw-r--r--include/version.mk21
1 files changed, 13 insertions, 8 deletions
diff --git a/include/version.mk b/include/version.mk
index a84065d1dd..c4747f236f 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -17,28 +17,31 @@ PKG_CONFIG_DEPENDS += \
CONFIG_VERSION_PRODUCT \
CONFIG_VERSION_HWREV \
-VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
+qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
+#'
+
+VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION))
-VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
+VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),Bleeding Edge)
-VERSION_NICK:=$(call qstrip,$(CONFIG_VERSION_NICK))
+VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
-VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
+VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots/trunk/%T/packages)
-VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
+VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
-VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
+VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
-VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
+VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
-VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV))
+VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
define taint2sym
@@ -80,3 +83,5 @@ VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
-e 's,%M,$(VERSION_MANUFACTURER),g' \
-e 's,%P,$(VERSION_PRODUCT),g' \
-e 's,%h,$(VERSION_HWREV),g'
+
+VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))