diff options
author | Simon Rettberg | 2023-01-23 10:49:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-01-23 10:49:35 +0100 |
commit | 74510d591702dd5c902d422a89e4a6f69cab46d0 (patch) | |
tree | 4ec57ae6a27df0f434e23650da1ebe2404cb8733 /core/includes | |
parent | [pvs2] Only start pvsmgr in hybrid mode if it is actually requested (diff) | |
download | mltk-74510d591702dd5c902d422a89e4a6f69cab46d0.tar.gz mltk-74510d591702dd5c902d422a89e4a6f69cab46d0.tar.xz mltk-74510d591702dd5c902d422a89e4a6f69cab46d0.zip |
[inc/keyvalueutil] Fixup a bit
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")" |