diff options
Diffstat (limited to 'core/includes')
-rw-r--r-- | core/includes/keyvalueutil.inc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/includes/keyvalueutil.inc b/core/includes/keyvalueutil.inc index cd1a0096..f909fd92 100644 --- a/core/includes/keyvalueutil.inc +++ b/core/includes/keyvalueutil.inc @@ -21,10 +21,13 @@ add_key_value () { [ -z "$TARGET_BUILD_DIR" ] && perror "No TARGET_BUILD_DIR set. Aborting for safety." local FILE="$TARGET_BUILD_DIR/$1" local KEY="$2" - local VALUE="$(echo "$3" | sed "s/'/\\\\'/g")" # \\\\\\\\\\\\\\\\\\\\\\ßß + local VALUE="${3//\'/\'\\\'\'}" # \\\\\\\\\\\\\\\\\\\\\\ßß Escape ' as '\'' if [ -s "$FILE" ]; then local CURRENT="$(grep -E "^\s*$KEY=.*$" "$FILE" | awk -F '=' '{$1=""; printf $0}' | itrim)" - [ -n "$CURRENT" -a "'$VALUE'" != "$CURRENT" ] && perror "Cannot set $KEY to '$VALUE' as it is already set to $CURRENT" + [ -n "$CURRENT" ] \ + && [ "'$VALUE'" != "$CURRENT" ] \ + && [ "$3" != "$CURRENT" ] \ + && perror "Cannot set $KEY to '$3' as it is already set to '$CURRENT'" [ -n "$CURRENT" ] && return 0 fi mkdir -p "$(dirname "$FILE")" |