summaryrefslogtreecommitdiff
path: root/experimental/mariadb/mariadb.initd
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-14 12:33:26 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-14 12:33:26 +0000
commit19b6bb3093864849a208b0e423511f5c9c7747a1 (patch)
tree2ebeb9f29e375b68830f5f9bcaa5ebb1064f6dd6 /experimental/mariadb/mariadb.initd
parent44c9f39fab893cc68c7c98a59fe2849c0aa7a478 (diff)
downloadpackages-19b6bb3093864849a208b0e423511f5c9c7747a1.tar.gz
packages-19b6bb3093864849a208b0e423511f5c9c7747a1.tar.bz2
packages-19b6bb3093864849a208b0e423511f5c9c7747a1.tar.xz
packages-19b6bb3093864849a208b0e423511f5c9c7747a1.zip
experimental/mariadb: ugly pos
Diffstat (limited to 'experimental/mariadb/mariadb.initd')
-rw-r--r--experimental/mariadb/mariadb.initd40
1 files changed, 40 insertions, 0 deletions
diff --git a/experimental/mariadb/mariadb.initd b/experimental/mariadb/mariadb.initd
new file mode 100644
index 000000000..143ca8ff5
--- /dev/null
+++ b/experimental/mariadb/mariadb.initd
@@ -0,0 +1,40 @@
+#!/sbin/openrc-run
+
+getconf() {
+ v=$(my_print_defaults --mysqld | grep ^--$1)
+ [ -z $v ] && echo $2 || echo ${v#*=}
+}
+
+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 --rpm
+ 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."
+ fi
+}
+
+start_post() {
+ ewaitfile 10 $(getconf socket "/run/mysqld/mysqld.sock")
+}
+
+stop_pre() {
+ pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
+}
+