install.sh 882 B

12345678910111213141516171819202122232425262728293031
  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@herve.info",
  22. "new_ext@mozilla.org"
  23. ]
  24. }
  25. EOF