Matthos Denys bdd57d0a05 its a live
2021-03-03 14:41:07 +03:00

63 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
rc default
if [ ! -d "/run/mysqld" ]; then
mkdir -p /run/mysqld
fi
rc-status
touch /run/openrc/softlevel
/etc/init.d/mariadb setup
/etc/init.d/mariadb start
mysql < mysql.sql
mysql -u root wordpress < wordpress.sql
/etc/init.d/mariadb stop
/usr/bin/supervisord
# if [ -d /var/lib/mysql/mysql ]; then
# echo '[i] MySQL directory already present, skipping creation'
# else
# echo "[i] MySQL data directory not found, creating initial DBs"
# # chown -R mysql:mysql /var/lib/mysql
# # init database
# echo 'Initializing database'
# mysql_install_db --user=mysql > /dev/null
# echo 'Database initialized'
# echo "[i] MySql root password: root"
# # create temp file
# tfile=`mktemp`
# if [ ! -f "$tfile" ]; then
# return 1
# fi
# # save sql
# echo "[i] Create temp file: $tfile"
# cat << EOF > $tfile
# CREATE DATABASE wordpress;
# CREATE USER 'new'@'%' IDENTIFIED BY '';
# GRANT ALL PRIVILEGES ON *.* TO 'new'@'%' WITH GRANT OPTION;
# FLUSH PRIVILEGES;
# EOF
# echo 'FLUSH PRIVILEGES;' >> $tfile
# # run sql in tempfile
# echo "[i] run tempfile: $tfile"
# /usr/bin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile
# rm -f $tfile
# fi
# echo "[i] Sleeping 5 sec"
# sleep 5
# echo '[i] start running mysqld'
# exec /usr/bin/mysqld_safe