Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

setup 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. if [ ! -d /run/mysqld ]; then
  3. echo "/run/mysqld not found so creating one"
  4. mkdir -p /run/mysqld
  5. fi
  6. chown mysql:mysql /run/mysqld
  7. if [ /etc/my.cnf.d/mariadb-server.cnf ]; then
  8. echo "Deleting dumb configuration file in newer mariadb alpine package"
  9. rm /etc/my.cnf.d/mariadb-server.cnf
  10. fi
  11. if [ ! -d $DATADIR ]; then
  12. echo "initializing db because $DATADIR is missing"
  13. echo "creating $DATADIR and ensuring permissions"
  14. mkdir -p $DATADIR
  15. chown mysql:mysql $DATADIR
  16. echo "installing db"
  17. su-exec mysql:mysql mysql_install_db --force --datadir=$DATADIR
  18. echo "pushing initialization data into server"
  19. su-exec mysql:mysql mysqld --bind-address=127.0.0.1 --datadir=$DATADIR &
  20. pid="$!"
  21. for i in {30..0}; do
  22. if echo 'SELECT 1' | mysql &> /dev/null; then
  23. break
  24. fi
  25. echo 'MySQL init process in progress...'
  26. sleep 5
  27. done
  28. envsubst "`printf '${%s} ' $(sh -c "env|cut -d'=' -f1")`" < /etc/templates/dbinit.sql > /tmp/dbinit.sql
  29. cat /tmp/dbinit.sql | mysql
  30. if ! kill -s TERM "$pid" || ! wait "$pid"; then
  31. echo >&2 'MySQL init process failed.'
  32. exit 1
  33. fi
  34. rm /tmp/dbinit.sql
  35. fi
  36. su-exec mysql:mysql mysqld --bind-address=127.0.0.1 --datadir=$DATADIR &
  37. pid="$!"
  38. for i in {30..0}; do
  39. if echo 'SELECT 1' | mysql &> /dev/null; then
  40. break
  41. fi
  42. echo 'MySQL init process in progress...'
  43. sleep 5
  44. done
  45. mysql_upgrade
  46. if ! kill -s TERM "$pid" || ! wait "$pid"; then
  47. echo >&2 'MySQL upgrade process failed.'
  48. exit 1
  49. fi