You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jitsi-meet-tokens.postinst 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. # postinst script for jitsi-meet-tokens
  3. #
  4. # see: dh_installdeb(1)
  5. set -e
  6. # summary of how this script can be called:
  7. # * <postinst> `configure' <most-recently-configured-version>
  8. # * <old-postinst> `abort-upgrade' <new version>
  9. # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  10. # <new-version>
  11. # * <postinst> `abort-remove'
  12. # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  13. # <failed-install-package> <version> `removing'
  14. # <conflicting-package> <version>
  15. # for details, see http://www.debian.org/doc/debian-policy/ or
  16. # the debian-policy package
  17. case "$1" in
  18. configure)
  19. # loading debconf
  20. . /usr/share/debconf/confmodule
  21. db_get jitsi-meet-prosody/jvb-hostname
  22. JVB_HOSTNAME="$RET"
  23. db_get jitsi-meet-tokens/appid
  24. if [ "$RET" = "false" ] ; then
  25. echo "Application ID is mandatory"
  26. exit 1
  27. fi
  28. APP_ID=$RET
  29. db_get jitsi-meet-tokens/appsecret
  30. if [ "$RET" = "false" ] ; then
  31. echo "Application secret is mandatory"
  32. fi
  33. APP_SECRET=$RET
  34. PROSODY_HOST_CONFIG="/etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua"
  35. # Store config filename for purge
  36. db_set jitsi-meet-prosody/prosody_config "$PROSODY_HOST_CONFIG"
  37. db_stop
  38. if [ -f "$PROSODY_HOST_CONFIG" ] ; then
  39. # search for --plugin_paths, if this is not enabled this is the
  40. # first time we install tokens package and needs a config change
  41. if grep -q "\-\-plugin_paths" "$PROSODY_HOST_CONFIG"; then
  42. # enable tokens in prosody host config
  43. sed -i 's/--plugin_paths/plugin_paths/g' $PROSODY_HOST_CONFIG
  44. sed -i 's/authentication = "anonymous"/authentication = "token"/g' $PROSODY_HOST_CONFIG
  45. sed -i 's/ --allow_unencrypted_plain_auth/ allow_unencrypted_plain_auth/g' $PROSODY_HOST_CONFIG
  46. sed -i "s/ --app_id=\"example_app_id\"/ app_id=\"$APP_ID\"/g" $PROSODY_HOST_CONFIG
  47. sed -i "s/ --app_secret=\"example_app_secret\"/ app_secret=\"$APP_SECRET\"/g" $PROSODY_HOST_CONFIG
  48. sed -i 's/ --modules_enabled = { "token_verification" }/ modules_enabled = { "token_verification" }/g' $PROSODY_HOST_CONFIG
  49. # Install luajwt
  50. if ! luarocks install luajwtjitsi; then
  51. echo "Failed to install luajwtjitsi - try installing it manually"
  52. fi
  53. # Install basexx
  54. if ! luarocks install basexx; then
  55. echo "Failed to install basexx - try installing it manually"
  56. fi
  57. if [ -x "/etc/init.d/prosody" ]; then
  58. invoke-rc.d prosody restart
  59. fi
  60. echo "This package requires BOSH Prosody module to be patched !"
  61. echo "Use the following command, after this package has been installed and"
  62. echo "after every prosody-trunk upgrade:"
  63. echo "sudo patch -N /usr/lib/prosody/modules/mod_bosh.lua /usr/share/jitsi-meet/prosody-plugins/mod_bosh.lua.patch"
  64. fi
  65. else
  66. echo "Prosody config not found at $PROSODY_HOST_CONFIG - unable to auto-configure token authentication"
  67. fi
  68. ;;
  69. abort-upgrade|abort-remove|abort-deconfigure)
  70. ;;
  71. *)
  72. echo "postinst called with unknown argument \`$1'" >&2
  73. exit 1
  74. ;;
  75. esac
  76. # dh_installdeb will replace this with shell code automatically
  77. # generated by other debhelper scripts.
  78. #DEBHELPER#
  79. exit 0