Commit a4cc6fb9 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-15526 SysV init service deployed file '/etc/init.d/mysql' prevents...

MDEV-15526 SysV init service deployed file '/etc/init.d/mysql' prevents systemctl disable command to work correctly (mariadb|mysql naming support) (debian/ubuntu)

mariadb service is controlled by systemd

Do not install SysV init script on Debian/Ubuntu in /etc/init.d/
put it in /usr/share/mysql in case the user would need it for something.

Use systemctl in pre/post scripts directly
without funky conditionals and wrapper scripts
parent 0a43df4f
......@@ -2,6 +2,7 @@ debian/additions/debian-start etc/mysql
debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
debian/additions/mysql.init usr/share/mysql
etc/apparmor.d/usr.sbin.mysqld
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
usr/bin/aria_chk
......
......@@ -17,11 +17,7 @@ ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
set -o pipefail
invoke() {
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d mysql $1
else
/etc/init.d/mysql $1
fi
systemctl $1 mysql
}
case "$1" in
......
......@@ -12,11 +12,7 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# is running!
stop_server() {
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d mysql stop
else
/etc/init.d/mysql stop
fi
systemctl stop mysql
errno=$?
set -e
......
......@@ -20,25 +20,18 @@ mysql_upgradedir=/var/lib/mysql-upgrade
# do it himself. No database directories should be removed while the server
# is running! Another mysqld in e.g. a different chroot is fine for us.
stop_server() {
if [ ! -x /etc/init.d/mysql ]; then return; fi
# Return immediately if there are no mysql processes running
# as there is no point in trying to shutdown in that case.
if ! pgrep mysqld > /dev/null; then return; fi
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
cmd="invoke-rc.d mysql stop"
else
cmd="/etc/init.d/mysql stop"
fi
$cmd
systemctl stop mysql
errno=$?
set -e
# 0=ok, 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
echo "${cmd/ */} returned $errno" 1>&2
echo "'systemctl stop mysql' returned $errno" 1>&2
echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
db_stop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment