Changeset 41885


Ignore:
Timestamp:
2014-07-29T15:30:23+02:00 (4 years ago)
Author:
nbd
Message:

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@…>

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/version.mk

    r41884 r41885  
    1818        CONFIG_VERSION_HWREV \ 
    1919 
    20 VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) 
     20qstrip_escape=$(subst ','\'',$(call qstrip,$(1))) 
     21#' 
     22 
     23VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER)) 
    2124VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION)) 
    2225 
    23 VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) 
     26VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER)) 
    2427VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),Bleeding Edge) 
    2528 
    26 VERSION_NICK:=$(call qstrip,$(CONFIG_VERSION_NICK)) 
     29VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK)) 
    2730VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE)) 
    2831 
    29 VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) 
     32VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO)) 
    3033VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots/trunk/%T/packages) 
    3134 
    32 VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) 
     35VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST)) 
    3336VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) 
    3437 
    35 VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER)) 
     38VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER)) 
    3639VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt) 
    3740 
    38 VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT)) 
     41VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT)) 
    3942VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic) 
    4043 
    41 VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV)) 
     44VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV)) 
    4245VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0) 
    4346 
     
    8184        -e 's,%P,$(VERSION_PRODUCT),g' \ 
    8285        -e 's,%h,$(VERSION_HWREV),g' 
     86 
     87VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED)) 
  • trunk/package/base-files/Makefile

    r41884 r41885  
    111111        $(VERSION_SED) \ 
    112112                $(1)/etc/banner \ 
    113                 $(1)/etc/openwrt_version \ 
     113                $(1)/etc/openwrt_version 
     114 
     115        $(VERSION_SED_SCRIPT) \ 
    114116                $(1)/etc/openwrt_release \ 
    115117                $(1)/etc/device_info 
  • trunk/package/base-files/files/etc/device_info

    r41884 r41885  
    1 DEVICE_MANUFACTURER="%M" 
    2 DEVICE_PRODUCT="%P" 
    3 DEVICE_REVISION="%h" 
     1DEVICE_MANUFACTURER='%M' 
     2DEVICE_PRODUCT='%P' 
     3DEVICE_REVISION='%h' 
  • trunk/package/base-files/files/etc/openwrt_release

    r39437 r41885  
    1 DISTRIB_ID="%D" 
    2 DISTRIB_RELEASE="%C" 
    3 DISTRIB_REVISION="%R" 
    4 DISTRIB_CODENAME="%n" 
    5 DISTRIB_TARGET="%S" 
    6 DISTRIB_DESCRIPTION="%D %N %V" 
    7 DISTRIB_TAINTS="%t" 
     1DISTRIB_ID='%D' 
     2DISTRIB_RELEASE='%C' 
     3DISTRIB_REVISION='%R' 
     4DISTRIB_CODENAME='%n' 
     5DISTRIB_TARGET='%S' 
     6DISTRIB_DESCRIPTION='%D %N %V' 
     7DISTRIB_TAINTS='%t' 
Note: See TracChangeset for help on using the changeset viewer.