PREIN
/bin/sh
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
-c "MariaDB Server" -u 27 mysql >/dev/null 2>&1 || :
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/usr/bin/systemctl --no-reload disable mysqld.service > /dev/null 2>&1 || :
/usr/bin/systemctl stop mysqld.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
# As soon as Fedora 17, which doesn't know %systemd_post macro,
# is retired, we can remove the check for availability of the macro
# and the alternative code.
# Let's keep it there now for anyone trying to build the package
# for F17 on his own.
if [ $1 -eq 1 ] ; then
# Initial installation
/usr/bin/systemctl preset mysqld.service >/dev/null 2>&1 || :
fi
/bin/chmod 0755 /var/lib/mysql
/bin/touch /var/log/mysqld.log
# Handle upgrading from SysV initscript to native systemd unit.
# We can tell if a SysV version of mysql was previously installed by
# checking to see if the initscript is present.
POSTUN
/bin/sh
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/usr/bin/systemctl try-restart mysqld.service >/dev/null 2>&1 || :
fi
Triggers
mysql-server
/bin/sh
if [ -f /etc/rc.d/init.d/mysqld ]; then
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply mysqld
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save mysqld >/dev/null 2>&1 || :
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del mysqld >/dev/null 2>&1 || :
/bin/systemctl try-restart mysqld.service >/dev/null 2>&1 || :
fi