Browse Source

Old prosody config improvement - patch by Damian Minkov.

j8
paweldomas 11 years ago
parent
commit
36065b935c
1 changed files with 21 additions and 6 deletions
  1. 21
    6
      debian/jitsi-meet-prosody.postinst

+ 21
- 6
debian/jitsi-meet-prosody.postinst View File

@@ -35,10 +35,12 @@ case "$1" in
35 35
         db_stop
36 36
 
37 37
         PROSODY_CONFIG_PRESENT="true"
38
+        PROSODY_CREATE_JICOFO_USER="false"
38 39
         PROSODY_HOST_CONFIG="/etc/prosody/conf.avail/$JVB_HOSTNAME.cfg.lua"
40
+        PROSODY_CONFIG_OLD="/etc/prosody/prosody.cfg.lua"
39 41
         # if there is no prosody config extract our template
40 42
         # check for config in conf.avail or check whether it wasn't already configured in main config
41
-        if [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"$JVB_HOSTNAME\"" /etc/prosody/prosody.cfg.lua; then
43
+        if [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"$JVB_HOSTNAME\"" $PROSODY_CONFIG_OLD; then
42 44
             PROSODY_CONFIG_PRESENT="false"
43 45
             cp /usr/share/doc/jitsi-meet-prosody/prosody.cfg.lua-jvb.example $PROSODY_HOST_CONFIG
44 46
             sed -i "s/jitmeet.example.com/$JVB_HOSTNAME/g" $PROSODY_HOST_CONFIG
@@ -48,19 +50,32 @@ case "$1" in
48 50
             if [ ! -f /etc/prosody/conf.d/$JVB_HOSTNAME.cfg.lua ]; then
49 51
                 ln -s $PROSODY_HOST_CONFIG /etc/prosody/conf.d/$JVB_HOSTNAME.cfg.lua
50 52
             fi
51
-            # create 'focus@auth.domain' prosody user
52
-            # FIXME this duplicates with below
53
-            prosodyctl register $JICOFO_AUTH_USER $JICOFO_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD
53
+            PROSODY_CREATE_JICOFO_USER="true"
54 54
         fi
55
-        # on UPGRADE to server side focus check if focus is configured
55
+        # UPGRADE to server side focus check if focus is configured
56 56
         if [ -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"auth.$JVB_HOSTNAME\"" $PROSODY_HOST_CONFIG; then
57 57
             echo -e "\nVirtualHost \"auth.$JVB_HOSTNAME\"" >> $PROSODY_HOST_CONFIG
58 58
             echo -e "        authentication = \"internal_plain\"\n" >> $PROSODY_HOST_CONFIG
59 59
             echo -e "admins = { \"$JICOFO_AUTH_USER@auth.$JVB_HOSTNAME\" }\n" >> $PROSODY_HOST_CONFIG
60 60
             echo -e "Component \"focus.$JVB_HOSTNAME\"" >> $PROSODY_HOST_CONFIG
61 61
             echo -e "    component_secret=\"$JICOFO_SECRET\"\n" >> $PROSODY_HOST_CONFIG
62
+            PROSODY_CREATE_JICOFO_USER="true"
63
+        # UPGRADE to server side focus on old config(/etc/prosody/prosody.cfg.lua)
64
+        elif [ ! -f $PROSODY_HOST_CONFIG ] && ! grep -q "VirtualHost \"auth.$JVB_HOSTNAME\"" $PROSODY_CONFIG_OLD; then
65
+            echo -e "\nVirtualHost \"auth.$JVB_HOSTNAME\"" >> $PROSODY_CONFIG_OLD
66
+            echo -e "        authentication = \"internal_plain\"\n" >> $PROSODY_CONFIG_OLD
67
+            if ! grep -q "admins = { }" $PROSODY_CONFIG_OLD; then
68
+                echo -e "admins = { \"$JICOFO_AUTH_USER@auth.$JVB_HOSTNAME\" }\n" >> $PROSODY_CONFIG_OLD
69
+            else
70
+                sed -i "s/admins = { }/admins = { \"$JICOFO_AUTH_USER@auth.$JVB_HOSTNAME\" }\n/g" $PROSODY_CONFIG_OLD
71
+            fi
72
+            echo -e "Component \"focus.$JVB_HOSTNAME\"" >> $PROSODY_CONFIG_OLD
73
+            echo -e "    component_secret=\"$JICOFO_SECRET\"\n" >> $PROSODY_CONFIG_OLD
74
+            PROSODY_CREATE_JICOFO_USER="true"
75
+        fi
76
+
77
+        if [ "$PROSODY_CREATE_JICOFO_USER" = "true" ]; then
62 78
             # create 'focus@auth.domain' prosody user
63
-            # FIXME this duplicates with above
64 79
             prosodyctl register $JICOFO_AUTH_USER $JICOFO_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD
65 80
             # trigger a restart
66 81
             PROSODY_CONFIG_PRESENT="false"

Loading…
Cancel
Save