FusionPBX пре 8 година
родитељ
комит
29f55141b6
1 измењених фајлова са 23 додато и 4 уклоњено
  1. 23 4
      centos/resources/finish.sh

+ 23 - 4
centos/resources/finish.sh

@@ -4,14 +4,18 @@
 cd "$(dirname "$0")"
 
 #includes
+. ./config.sh
 . ./colors.sh
 . ./arguments.sh
+#. ./environment.sh
 
 #database details
 database_host=127.0.0.1
 database_port=5432
 database_username=fusionpbx
-database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
+if [ .$database_password = .'random' ]; then
+	database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
+fi
 
 #allow the script to use the new password
 export PGPASSWORD=$database_password
@@ -48,8 +52,12 @@ cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php
 #add the user
 user_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
 user_salt=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
-user_name=admin
-user_password=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | sed 's/[=\+//]//g')
+user_name=$system_username
+if [ .$system_password = .'random' ]; then
+	user_password=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | sed 's/[=\+//]//g')
+else
+	user_password=$system_password
+fi
 password_hash=$(php -r "echo md5('$user_salt$user_password');");
 psql --host=$database_host --port=$database_port --username=$database_username -t -c "insert into v_users (user_uuid, domain_uuid, username, password, salt, user_enabled) values('$user_uuid', '$domain_uuid', '$user_name', '$password_hash', '$user_salt', 'true');"
 
@@ -74,6 +82,7 @@ sed -i /etc/freeswitch/autoload_configs/xml_cdr.conf.xml -e s:"{v_pass}:$xml_cdr
 #app defaults
 cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php
 
+#restart services
 systemctl daemon-reload
 systemctl mask wpa_supplicant.service
 systemctl stop wpa_supplicant.service
@@ -84,11 +93,21 @@ systemctl enable nginx
 systemctl enable freeswitch
 systemctl enable memcached
 systemctl enable postgresql-9.4
+systemctl daemon-reload
+systemctl restart freeswitch
 
 #welcome message
 echo ""
 verbose "Installation has completed."
-error "Please note details below and reboot your system"
+echo ""
+echo "   Use a web browser to login."
+echo "      domain name: https://$domain_name"
+echo "      username: $user_name"
+echo "      password: $user_password"
+echo ""
+echo "   The domain name in the browser is used by default as part of the authentication."
+echo "   If you need to login to a different domain then use username@domain."
+echo "      username: $user_name@$domain_name";
 echo ""
 echo "   Official FusionPBX Training"
 echo "      Fastest way to learn FusionPBX. For more information https://www.fusionpbx.com."