install.sh 854 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # Install the Python application and the "backend" manifest, used to allow the extension to communicate
  3. # with a background process.
  4. #
  5. # https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests
  6. set -eu
  7. EXTENSION_NAME="job_search_background"
  8. EXTENSION_BACKEND_PATH=$(realpath $0 | xargs dirname)
  9. EXTENSION_BIN=${EXTENSION_BACKEND_PATH}/run.sh
  10. NATIVE_MESSAGING_DIR=~/.mozilla/native-messaging-hosts
  11. NATIVE_MESSAGING_MANIFEST=${NATIVE_MESSAGING_DIR}/${EXTENSION_NAME}.json
  12. mkdir -p ${NATIVE_MESSAGING_DIR}
  13. (cd ${EXTENSION_BACKEND_PATH} && pdm sync)
  14. cat << EOF > ${NATIVE_MESSAGING_MANIFEST}
  15. {
  16. "name": "${EXTENSION_NAME}",
  17. "description": "Example host for native messaging",
  18. "path": "${EXTENSION_BIN}",
  19. "type": "stdio",
  20. "allowed_extensions": [
  21. "job_search_ps@herve.info"
  22. ]
  23. }
  24. EOF