Painted-Fox/docker-mariadb — pull request #6 by riccieri (2014-01-11 01:35:47+00:00)
Title: Only create user/password on the first run

If `docker run` is called without `-e USER=user -e PASS=pass`, the container resets MARIADB_USER and MARIADB_PASS after every `docker start`, which means that every container that is `docker run -link`-ed to it needs to be reconfigured.

This PR makes the user creation process run only on the first run of the container (identified by an empty `firstrun` file on the container root).

A somewhat unrelated change, but that simplified the code, is that `mysqld` is not called twice anymore; The main process `exec`s mysqld on the end, and post-start actions are done in a subshell (see [the `wait_for_mysql_and_run_post_start_action` function](https://github.com/riccieri/docker-mariadb/blob/ec96e19abe8d077f69c595a34c98888b809f8aaa/scripts/start.sh#L17)).