Escape @ characters in paths for use with sed, fix #13

This commit is contained in:
Thomas Vogt 2018-04-05 11:26:30 +02:00
parent 7217711743
commit fc99c2c875

View File

@ -114,17 +114,22 @@ echo "Installing $BROWSER_NAME host config"
# Create config dir if not existing # Create config dir if not existing
mkdir -p "$TARGET_DIR" mkdir -p "$TARGET_DIR"
PATH_ESC="$(echo $PATH | sed -e 's/@/\\@/g')"
PASS_PATH_ESC="$(echo $PASS_PATH | sed -e 's/@/\\@/g')"
HOST_FILE_PATH_ESC="$(echo $HOST_FILE_PATH | sed -e 's/@/\\@/g')"
PYTHON3_PATH_ESC="$(echo $PYTHON3_PATH | sed -e 's/@/\\@/g')"
# Replace path to python3 executable \ # Replace path to python3 executable \
# Replace path to pass (only in a line starting with "COMMAND =") \ # Replace path to pass (only in a line starting with "COMMAND =") \
# Set the PATH to match this script's \ # Set the PATH to match this script's \
HOST_SED=" \ HOST_SED=" \
1 s@.*@#!${PYTHON3_PATH}@; \ 1 s@.*@#!${PYTHON3_PATH_ESC}@; \
/^COMMAND *=/s@\"pass\"@\"$PASS_PATH\"@; \ /^COMMAND *=/s@\"pass\"@\"$PASS_PATH_ESC\"@; \
s@\"PATH\":.*@\"PATH\": \"$PATH\"@; \ s@\"PATH\":.*@\"PATH\": \"$PATH_ESC\"@; \
" "
# Replace path to host \ # Replace path to host \
MANIFEST_SED=" \ MANIFEST_SED=" \
s@PLACEHOLDER@$HOST_FILE_PATH@; \ s@PLACEHOLDER@$HOST_FILE_PATH_ESC@; \
" "
if [ "$USE_LOCAL_FILES" = true ]; then if [ "$USE_LOCAL_FILES" = true ]; then