Unverified Commit 53570e23 authored by Kienan Stewart's avatar Kienan Stewart
Browse files

Enter default db_server information before templating

Refs #335
parent caae003c
......@@ -90,6 +90,23 @@ lock_jobs
# hook
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
#
......@@ -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
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
echo "Creating admin user..."
echo ""
if su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/newone.php
then
if [ "$NEWONE_RETVAL" ] ; then
echo "*******************************************"
echo "* *"
echo "* Admin account *"
......@@ -626,7 +636,7 @@ if [ "$HAS_ROOT" != "1" ]; then
echo "* *"
echo "*******************************************"
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
else
##UPDATE default db_server following /etc/alternc/my.cnf values
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment