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 /sbin/nologin \
-c "MariaDB Server" -u 27 mysql >/dev/null 2>&1 || :
# Explicitly enable mysqld if it was enabled in the beggining
# of the transaction. Otherwise mysqld is disabled always when
# replacing mysql with mariadb, because it is not recognized
# as updating, but rather as removal and install.
if /bin/systemctl is-enabled mysqld.service >/dev/null 2>&1 ; then
touch /var/lib/rpm-state/mysqld_enabled >/dev/null 2>&1 || :
fi
# Since mysqld.service became a symlink to mariadb.service, turning off
# the running mysqld service doesn't work fine (BZ#1002996). As a work-around
# we explicitly stop mysqld before upgrade and start after it again.
if [ ! -L /usr/lib/systemd/system/mysqld.service ] && /bin/systemctl is-active mysqld.service &>/dev/null ; then
touch /var/lib/rpm-state/mysqld_running >/dev/null 2>&1 || :
/bin/systemctl stop mysqld.service >/dev/null 2>&1 || :
fi
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
systemctl --no-reload disable mariadb.service > /dev/null 2>&1 || :
systemctl stop mariadb.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset mariadb.service >/dev/null 2>&1 || :
fi
/bin/chmod 0755 /var/lib/mysql
/usr/sbin/update-alternatives --install /usr/bin/mysqlbug \
mysqlbug /usr/lib64/mysql/mysqlbug 64
POSTUN
/bin/sh
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
systemctl try-restart mariadb.service >/dev/null 2>&1 || :
fi
if [ $1 -eq 0 ] ; then
/usr/sbin/update-alternatives --remove mysqlbug /usr/lib64/mysql/mysqlbug
fi
POSTTRANS
/bin/sh
if [ -f /var/lib/rpm-state/mysqld_enabled ] ; then
/bin/systemctl enable mariadb.service >/dev/null 2>&1 || :
rm -f /var/lib/rpm-state/mysqld_enabled >/dev/null 2>&1 || :
fi
if [ -f /var/lib/rpm-state/mysqld_running ] ; then
/bin/systemctl start mariadb.service >/dev/null 2>&1 || :
rm -f /var/lib/rpm-state/mysqld_running >/dev/null 2>&1 || :
fi