Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #7 from mederly/mariadb10
Add "if_needed" value for CREATE_NEW_DATABASE
pcaskey committed Sep 26, 2018
2 parents c74faae + 637acf8 commit ae67e47
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion container_files/bin/start.sh
@@ -17,7 +17,7 @@ if [ -e "/tmp/firsttimerunning" ]; then

echo "Setting DataDir: $MYSQL_DATADIR" >> $log

if [ "$CREATE_NEW_DATABASE" == "1" ]; then
if [[ $CREATE_NEW_DATABASE == 1 || ($CREATE_NEW_DATABASE == if_needed && ( ! -d $MYSQL_DATADIR || -z $(ls -A $MYSQL_DATADIR) ) ) ]]; then

echo "Installing MariaDB" >> $log

@@ -71,6 +71,12 @@ if [ -e "/tmp/firsttimerunning" ]; then
/usr/bin/mysqld_safe --init-file="$tempSqlFile" --datadir="$MYSQL_DATADIR"
else
echo "Not Creating a MariaDB - Using Existing from DataDir: $MYSQL_DATADIR" >> $log
echo "Fixing Permissions" >> $log
chown -R mysql:mysql $MYSQL_DATADIR
/opt/bin/fix-permissions.sh $MYSQL_DATADIR >> $log
/opt/bin/fix-permissions.sh /var/log/mariadb/ >> $log
/opt/bin/fix-permissions.sh /var/run/ >> $log
echo "Done Fixing Permissions" >> $log
rm -f /tmp/firsttimerunning
/usr/bin/mysqld_safe --datadir="$MYSQL_DATADIR"
fi

0 comments on commit ae67e47

Please sign in to comment.