Skip to content

Commit

Permalink
Merge pull request #12 from vizv/fix-sed-issue
Browse files Browse the repository at this point in the history
Fix: Use in-place edit option that works for Linux, macOS, and OpenBSD
  • Loading branch information
tuxor1337 authored Apr 1, 2018
2 parents bbf47a4 + d0527d8 commit ab8125d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/install_host_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ else
curl -sSL "$MANIFEST_URL" > "$MANIFEST_FILE_PATH"
fi

if [ "$KERNEL_NAME" == 'Darwin' ] || [ "$IS_BSD" = true ]; then
# Use BSD style sed on macOS and BSD systems
# When using sed on macOS, backup extension is an mandatory argument
# whereas on GNU sed or BSD sed backup extension may be omit.
if [ "$KERNEL_NAME" == 'Darwin' ]; then
# Replace path to python3 executable
/usr/bin/sed -i '' "1 s@.*@#\!${PYTHON3_PATH}@" "$HOST_FILE_PATH"
# Replace path to host
/usr/bin/sed -i '' -e "s/PLACEHOLDER/$ESCAPED_HOST_FILE_PATH/" "$MANIFEST_FILE_PATH"
else
# Replace path to python3 executable
sed -i "1c#\!${PYTHON3_PATH}" "$HOST_FILE_PATH"
sed -i "1 s@.*@#\!${PYTHON3_PATH}@" "$HOST_FILE_PATH"
# Replace path to host
sed -i -e "s/PLACEHOLDER/$ESCAPED_HOST_FILE_PATH/" "$MANIFEST_FILE_PATH"
fi
Expand Down

0 comments on commit ab8125d

Please sign in to comment.