From fc99c2c8756449ea8830346534c948b3823f1706 Mon Sep 17 00:00:00 2001 From: Thomas Vogt Date: Thu, 5 Apr 2018 11:26:30 +0200 Subject: [PATCH] Escape @ characters in paths for use with sed, fix #13 --- src/install_host_app.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/install_host_app.sh b/src/install_host_app.sh index 7626ce4..a395969 100755 --- a/src/install_host_app.sh +++ b/src/install_host_app.sh @@ -114,17 +114,22 @@ echo "Installing $BROWSER_NAME host config" # Create config dir if not existing 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 pass (only in a line starting with "COMMAND =") \ # Set the PATH to match this script's \ HOST_SED=" \ -1 s@.*@#!${PYTHON3_PATH}@; \ -/^COMMAND *=/s@\"pass\"@\"$PASS_PATH\"@; \ -s@\"PATH\":.*@\"PATH\": \"$PATH\"@; \ +1 s@.*@#!${PYTHON3_PATH_ESC}@; \ +/^COMMAND *=/s@\"pass\"@\"$PASS_PATH_ESC\"@; \ +s@\"PATH\":.*@\"PATH\": \"$PATH_ESC\"@; \ " # Replace path to host \ MANIFEST_SED=" \ -s@PLACEHOLDER@$HOST_FILE_PATH@; \ +s@PLACEHOLDER@$HOST_FILE_PATH_ESC@; \ " if [ "$USE_LOCAL_FILES" = true ]; then