aboutsummaryrefslogtreecommitdiffstats
path: root/main/mariadb/mariadb.initd
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2019-05-09 21:09:43 +0200
committerJakub Jirutka <jakub@jirutka.cz>2019-05-09 21:39:09 +0200
commitd8ea14ea1b5eea168b9b0bb0399aa8585facb8ec (patch)
tree28b3ec9e27e49e19eb9ee5ccbfd142013a09e008 /main/mariadb/mariadb.initd
parentf41fee8fe71a7a541f0558c4427149c563696c2e (diff)
downloadaports-d8ea14ea1b5eea168b9b0bb0399aa8585facb8ec.tar.bz2
aports-d8ea14ea1b5eea168b9b0bb0399aa8585facb8ec.tar.xz
main/mariadb: reformat init script
Diffstat (limited to 'main/mariadb/mariadb.initd')
-rw-r--r--main/mariadb/mariadb.initd25
1 files changed, 13 insertions, 12 deletions
diff --git a/main/mariadb/mariadb.initd b/main/mariadb/mariadb.initd
index 35906a3a8c..fb0c89a9e9 100644
--- a/main/mariadb/mariadb.initd
+++ b/main/mariadb/mariadb.initd
@@ -1,29 +1,20 @@
#!/sbin/openrc-run
-
-getconf() {
- v=$(my_print_defaults --mysqld | grep ^--$1)
- [ -z $v ] && echo $2 || echo ${v#*=}
-}
+extra_stopped_commands="setup"
retry="60"
-extra_stopped_commands="setup"
command="/usr/bin/mysqld_safe"
command_args="--syslog --nowatch"
+
depend() {
use net
need localmount
}
-setup() {
- ebegin "Creating a new MySQL database"
- mysql_install_db --user=mysql --datadir=/var/lib/mysql
- eend $?
-}
-
start_pre() {
pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
command_args="$command_args --pid-file=$pidfile"
required_dirs=$(getconf datadir "/var/lib/mysql")
+
if [ ! -d $required_dirs/mysql ]; then
eerror "Datadir '$required_dirs' is empty or invalid."
eerror "Run '/etc/init.d/mariadb setup' to create new database."
@@ -38,3 +29,13 @@ stop_pre() {
pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
}
+setup() {
+ ebegin "Creating a new MySQL database"
+ mysql_install_db --user=mysql --datadir=/var/lib/mysql
+ eend $?
+}
+
+getconf() {
+ v=$(my_print_defaults --mysqld | grep ^--$1)
+ [ -z $v ] && echo $2 || echo ${v#*=}
+}