aboutsummaryrefslogtreecommitdiff
path: root/templates/run.j2
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-10-01 22:02:32 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-10-01 22:02:32 -0400
commitacc2965258fb85aca1faf92ea8b65a25f964c8fa (patch)
tree22e89f849a73b8c4e0fe214e8b610d1e36d6bd84 /templates/run.j2
downloadalpine-mysql-acc2965258fb85aca1faf92ea8b65a25f964c8fa.tar.gz
alpine-mysql-acc2965258fb85aca1faf92ea8b65a25f964c8fa.tar.xz
Initial
Diffstat (limited to 'templates/run.j2')
-rw-r--r--templates/run.j27
1 files changed, 7 insertions, 0 deletions
diff --git a/templates/run.j2 b/templates/run.j2
new file mode 100644
index 0000000..f962193
--- /dev/null
+++ b/templates/run.j2
@@ -0,0 +1,7 @@
+#!/bin/sh
+mkdir -p /run/mysqld && chown mysql:mysql /run/mysqld
+datadir="$(sed -rne's/^datadir ?= ?//p' /etc/my.cnf)"
+if ! [ -d "$datadir" ] ; then
+ mysql_install_db --user=mysql
+fi
+exec chpst -u mysql:mysql mysqld