Fix mysql installation on openSUSE

Use os-svc-enable and -restart the mysql service to have "map-services"
handle the different service names on different Distros.
Create /var/lib/mysql on openSUSE. Otherwise register-state-path will
not prepare /var/lib/use-ephemeral/ correctly for it.
Create a /var/run/mysql/mysql.sock compatibility link to have mysql
clients find the database sockets. This needs to happen in the running
system as /var/run is a tmpfs on openSUSE.

Change-Id: I4086ff08ecd84072a109319ea8f872c75ab7ce45
This commit is contained in:
Ralf Haferkamp 2014-01-21 16:40:23 +01:00
parent 27aa243224
commit 4777f32ab9
2 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,8 @@ if [ -e /etc/init/mysql.conf ]; then
fi
# Fedora/RHEL install /etc/my.cnf but we do not want any unmanaged configs
rm -f /etc/my.cnf
# On openSUSE /var/lib/mysql is not part of the mariadb packages.
[ -d /var/lib/mysql ] || install -d -o mysql -g root -m 0700 /var/lib/mysql
register-state-path /var/lib/mysql
# We need to setup the directory with appropriate permissions and then
# the first time we boot a particular state partition we rsync this in.
@ -36,7 +38,7 @@ if [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
# mysqld.service -> mariadb.service to maintain backwards compatibility,
# there's a bug with systemd and symlinked service files:
# https://bugzilla.redhat.com/show_bug.cgi?id=1014311
systemctl enable mysqld.service || systemctl enable mariadb.service
os-svc-enable -n mysql || os-svc-enable -n mariadb
fi
DISTRO=`lsb_release -si` || true

View File

@ -1,2 +1,7 @@
#!/bin/bash
service mysql restart || service mysqld restart
os-svc-restart -n mysql
DISTRO=`lsb_release -si` || true
if [ "openSUSE project" = "$DISTRO" ]; then
ln -sf /var/run/mysqld/mysqld.sock /var/run/mysql/mysql.sock
fi