Spaces:
Sleeping
Sleeping
File size: 741 Bytes
013de3c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Error: Extension ID(e.g. cgiklkopeclbljnchnmlicaipolfojim) not provided." >&2
exit 1
fi
EXTENSION_ID=$1
# This script should be run from project root.
HOST_PATH="$(pwd)/native_host/host.py"
MANIFEST_DIR="$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts"
MANIFEST_PATH="$MANIFEST_DIR/com.rebrowse.host.json"
mkdir -p "$MANIFEST_DIR"
# Use # as sed delimiter to avoid issues with paths containing /
sed -e "s#__EXTENSION_ID__#${EXTENSION_ID}#g" \
-e "s#__HOST_PATH__#${HOST_PATH}#g" \
native_host/host.json > "$MANIFEST_PATH"
chmod 644 "$MANIFEST_PATH"
chmod +x native_host/host.py
echo "✅ Installed Native messaging host for Extension ID: ${EXTENSION_ID}" |