Browse Source

Ensure that prosody directory is available

Bob Mottram 8 years ago
parent
commit
0f227587bb
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      src/freedombone-app-xmpp

+ 13
- 0
src/freedombone-app-xmpp View File

@@ -298,6 +298,7 @@ function remove_xmpp {
298 298
     if [ -d /var/lib/prosody ]; then
299 299
         rm -rf /var/lib/prosody
300 300
     fi
301
+    groupdel prosody
301 302
 
302 303
     remove_completion_param install_xmpp
303 304
     sed -i '/xmpp/d' $COMPLETION_FILE
@@ -419,6 +420,13 @@ function install_xmpp_main {
419 420
         exit 52367
420 421
     fi
421 422
 
423
+    groupadd prosody
424
+
425
+    if [ ! -d /var/lib/prosody ]; then
426
+        mkdir /var/lib/prosody
427
+        chown -R prosody:prosody /var/lib/prosody
428
+    fi
429
+
422 430
     # obtain the prosody modules
423 431
     cd $INSTALL_DIR
424 432
     hg clone https://hg.prosody.im/prosody-modules/ prosody-modules
@@ -590,7 +598,12 @@ function install_xmpp_main {
590 598
             XMPP_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
591 599
         fi
592 600
     fi
601
+
593 602
     prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME "$XMPP_PASSWORD"
603
+    if [ ! "$?" = "0" ]; then
604
+        echo $'Unable to register prosody user'
605
+        exit 347682
606
+    fi
594 607
 
595 608
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a xmpp -p "$XMPP_PASSWORD"
596 609