From b35531d70e836209a996317b5373f9de7e97d13d Mon Sep 17 00:00:00 2001 From: steigr Date: Thu, 20 Jul 2017 22:28:23 +0200 Subject: [PATCH] Fix quoting in get_metadata to support spaces. Variables have to be quoted to avoid shell globbing, execution etc. - or just support spaces in e.g. taggings ( KEXEC_APPEND="root=/dev/vda my-very-special-kernel-cmdline" ). --- Linux/tree-common/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Linux/tree-common/functions b/Linux/tree-common/functions index a2ddefe..c3b82d0 100644 --- a/Linux/tree-common/functions +++ b/Linux/tree-common/functions @@ -152,8 +152,8 @@ has_opt() { get_metadata() { for idx in $(seq -w 0 $(scw-metadata --cached TAGS)); do tag=$(scw-metadata --cached TAGS_$idx) - if [ $(echo "$tag" | grep "^$1=") ]; then - echo $tag | sed 's/^[^=]*=//' | resolve_hostnames + if [ "$(echo "$tag" | grep "^$1=")" ]; then + echo "$tag" | sed 's/^[^=]*=//' | resolve_hostnames return fi done