Service startup follows sysv initscript and includes db init.
[Thomas: use a relative symlink rather than an absolute symlink.]
Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
$(TARGET_DIR)/etc/init.d/S97mysqld
endef
+define MYSQL_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 644 package/mysql/mysqld.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/mysqld.service
+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+ ln -sf ../../../../usr/lib/systemd/system/mysqld.service \
+ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mysqld.service
+endef
+
else
MYSQL_CONF_OPTS += \
--without-server
--- /dev/null
+[Unit]
+Description=MySQL database server
+
+[Service]
+ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
+ExecStart=/usr/bin/mysqld_safe
+Restart=always
+
+[Install]
+WantedBy=multi-user.target