Enter default db_server information before templating

Refs #335
This commit is contained in:
Kienan Stewart 2019-05-15 17:46:15 -04:00
parent caae003c60
commit 53570e236a
No known key found for this signature in database
GPG Key ID: 075A846E78FE47EA
1 changed files with 19 additions and 9 deletions

View File

@ -90,6 +90,23 @@ lock_jobs
# hook # hook
run-parts --arg=startup /usr/lib/alternc/install.d run-parts --arg=startup /usr/lib/alternc/install.d
#######################################################################
# Enter the initial database configuration if needed
#
# Creating admin user if needed
# This is done before any templating, since it adds the default database server.
# User feedback is provided near the end of the script.
HAS_ROOT=`mysql --defaults-file=/etc/alternc/my.cnf -e "SELECT COUNT(*) FROM membres WHERE login = 'admin' OR login = 'root' and su = 1" | tail -1`
if [ "$HAS_ROOT" != "1" ] ; then
echo "Creating admin user..."
echo ""
su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/newone.php
NEWONE_RETVAL=$?
fi
####################################################################### #######################################################################
# Script configuration # Script configuration
# #
@ -606,15 +623,8 @@ chown alterncpanel:adm /var/log/alternc/bureau.log /var/log/alternc/update_domai
# Launch a script that will populate AlternC variables as needed # Launch a script that will populate AlternC variables as needed
su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/variables.php su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/variables.php
# Creating admin user if needed
HAS_ROOT=`mysql --defaults-file=/etc/alternc/my.cnf -e "SELECT COUNT(*) FROM membres WHERE login = 'admin' OR login = 'root' and su = 1" | tail -1`
if [ "$HAS_ROOT" != "1" ]; then if [ "$HAS_ROOT" != "1" ]; then
echo "Creating admin user..." if [ "$NEWONE_RETVAL" ] ; then
echo ""
if su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/newone.php
then
echo "*******************************************" echo "*******************************************"
echo "* *" echo "* *"
echo "* Admin account *" echo "* Admin account *"
@ -626,7 +636,7 @@ if [ "$HAS_ROOT" != "1" ]; then
echo "* *" echo "* *"
echo "*******************************************" echo "*******************************************"
else else
echo "Unable to create the first AlternC account (named 'admin'). newone.php returned $?. Check your MySQL database, PHP, and the /etc/alternc/local.sh file. Also check for any error above during install." echo "Unable to create the first AlternC account (named 'admin'). newone.php returned $NEWONE_RETVAL. Check your MySQL database, PHP, and the /etc/alternc/local.sh file. Also check for any error above during install."
fi fi
else else
##UPDATE default db_server following /etc/alternc/my.cnf values ##UPDATE default db_server following /etc/alternc/my.cnf values