Commit 932e29d4 authored by Sergei Golubchik's avatar Sergei Golubchik

don't run SysV scripts in scriptlets if systemd is used

parent bfb0726f
...@@ -17,9 +17,7 @@ fi ...@@ -17,9 +17,7 @@ fi
if [ $1 = 1 ] ; then if [ $1 = 1 ] ; then
if [ -x /usr/bin/systemctl ] ; then if [ -x /usr/bin/systemctl ] ; then
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 /usr/bin/systemctl daemon-reload >/dev/null 2>&1
fi elif [ -x /sbin/chkconfig ] ; then
if [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql /sbin/chkconfig --add mysql
fi fi
......
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
if [ -x %{_sysconfdir}/init.d/mysql ] ; then # only restart the server if it was alredy running
# only restart the server if it was alredy running if [ -x /usr/bin/systemctl ] ; then
if %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then /usr/bin/systemctl daemon-reload > /dev/null 2>&1
%{_sysconfdir}/init.d/mysql restart /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
fi elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then
%{_sysconfdir}/init.d/mysql restart
fi fi
fi fi
......
if [ $1 = 0 ] ; then if [ $1 = 0 ] ; then
# Stop MySQL before uninstalling it # Stop MySQL before uninstalling it
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null
fi
# Don't start it automatically anymore # Don't start it automatically anymore
if [ -x /sbin/chkconfig ] ; then if [ -x /usr/bin/systemctl ] ; then
/sbin/chkconfig --del mysql /usr/bin/systemctl stop mariadb.service > /dev/null 2>&1
fi /usr/bin/systemctl disable mariadb.service > /dev/null 2>&1
fi
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null
fi
if [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --del mysql > /dev/null 2>&1
fi
fi fi
# We do not remove the mysql user since it may still own a lot of # We do not remove the mysql user since it may still own a lot of
......
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