Update
This commit is contained in:
parent
b278a896a8
commit
33ec29efc0
|
|
@ -29,29 +29,68 @@ git clone $BRANCH https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx
|
||||||
chown -R www-data:www-data /var/www/fusionpbx
|
chown -R www-data:www-data /var/www/fusionpbx
|
||||||
chmod -R 755 /var/www/fusionpbx/secure
|
chmod -R 755 /var/www/fusionpbx/secure
|
||||||
|
|
||||||
#create the /etc/fusionpbx directory and copy the config.php into it
|
#database details
|
||||||
#mkdir -p /etc/fusionpbx
|
database_host=127.0.0.1
|
||||||
#chown -R www-data:www-data /etc/fusionpbx
|
database_port=5432
|
||||||
#cp fusionpbx/config.php /etc/fusionpbx
|
database_username=fusionpbx
|
||||||
#sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:'
|
database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||||
#sed -i /etc/fusionpbx/config.php -e s:'{database_password}:1234:'
|
|
||||||
|
#allow the script to use the new password
|
||||||
|
export PGPASSWORD=$database_password
|
||||||
|
|
||||||
|
#update the database password
|
||||||
|
sudo -u postgres psql -c "ALTER USER fusionpbx WITH PASSWORD '$database_password';"
|
||||||
|
sudo -u postgres psql -c "ALTER USER freeswitch WITH PASSWORD '$database_password';"
|
||||||
|
|
||||||
|
#add the config.php
|
||||||
|
mkdir -p /etc/fusionpbx
|
||||||
|
chown -R www-data:www-data /etc/fusionpbx
|
||||||
|
cp fusionpbx/config.php /etc/fusionpbx
|
||||||
|
sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:'
|
||||||
|
sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:"
|
||||||
|
|
||||||
#add the database schema
|
#add the database schema
|
||||||
#cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_schema.php > /dev/null 2>&1
|
cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_schema.php > /dev/null 2>&1
|
||||||
|
|
||||||
#get the source code
|
#add the domain
|
||||||
git clone $BRANCH https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx
|
domain_name=$(hostname -f)
|
||||||
chown -R www-data:www-data /var/www/fusionpbx
|
domain_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||||
chmod -R 755 /var/www/fusionpbx/secure
|
psql --host=$database_host --port=$database_port --username=$database_username -c "insert into v_domains (domain_uuid, domain_name, domain_enabled) values('$domain_uuid', '$domain_name', 'true');"
|
||||||
|
|
||||||
#database_password=1234
|
#app defaults
|
||||||
#export PGPASSWORD=$database_password
|
cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php
|
||||||
#mkdir -p /etc/fusionpbx
|
|
||||||
#chown -R www-data:www-data /etc/fusionpbx
|
#add the user
|
||||||
#cp fusionpbx/config.php /etc/fusionpbx
|
user_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||||
#sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:'
|
user_salt=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||||
#sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:"
|
user_name=admin
|
||||||
#domain_name=$(hostname -f)
|
user_password=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||||
#domain_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
password_hash=$(php -r "echo md5('$user_salt$user_password');");
|
||||||
#psql --host=127.0.0.1 --port=5432 --username=fusionpbx -c "insert into v_domains (domain_uuid, domain_name, domain_enabled) values('$domain_uuid', '$domain_name', 'true');"
|
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');"
|
||||||
#cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php
|
|
||||||
|
#get the superadmin group_uuid
|
||||||
|
group_uuid=$(psql --host=$database_host --port=$database_port --username=$database_username -t -c "select group_uuid from v_groups where group_name = 'superadmin';");
|
||||||
|
group_uuid=$(echo $group_uuid | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
|
|
||||||
|
#add the user to the group
|
||||||
|
group_user_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||||
|
group_name=superadmin
|
||||||
|
psql --host=$database_host --port=$database_port --username=$database_username -c "insert into v_group_users (group_user_uuid, domain_uuid, group_name, group_uuid, user_uuid) values('$group_user_uuid', '$domain_uuid', '$group_name', '$group_uuid', '$user_uuid');"
|
||||||
|
|
||||||
|
#welcome message
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
verbose "Installation has completed."
|
||||||
|
echo ""
|
||||||
|
echo " Use a web browser to login."
|
||||||
|
echo " location: https://$domain_name"
|
||||||
|
echo " username: $user_name"
|
||||||
|
echo " password: $user_password"
|
||||||
|
echo ""
|
||||||
|
echo " If your server hostname is not a fully qualified domain name";
|
||||||
|
echo " Then login with your ip address and $user_name@$domain_name";
|
||||||
|
echo ""
|
||||||
|
echo " For additional information use the following links.";
|
||||||
|
echo " https://www.fusionpbx.com"
|
||||||
|
echo " http://docs.fusionpbx.com"
|
||||||
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue