raven-rhel9/mysql57/mysql57.spec
2024-02-21 15:07:07 +06:00

819 lines
26 KiB
RPMSpec

%define _default_patch_fuzz 2
# By default, a build will include the system SSL library.
%{?with_ssl: %global ssl_option -DWITH_SSL=%{with_ssl}}
%global _root_libdir %{_libdir}
%global _root_includedir %{_includedir}
%global _prefix /usr
%global _sysconfdir %{_prefix}/etc
%global _libdir %{_prefix}/lib64
%global _sbindir %{_prefix}/sbin
%global _includedir %{_prefix}/include
%global _datadir %{_prefix}/share
%global _mandir %{_datadir}/man
%global _docdir %{_datadir}/doc
%global _infodir %{_datadir}/inf
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%global with_systemd 1
%else
%global with_systemd 0
%endif
%if 0%{?rhel} >= 8
%global _rundir /run/mysql
%else
%global _rundir /var/run/mysql
%endif
Name: mysql57
Version: 5.7.42
Release: 1%{dist}
Summary: MySQL client programs and shared libraries
Group: Applications/Databases
URL: http://www.mysql.com
# exceptions allow client libraries to be linked with most open source SW,
# not only GPL code. See README.mysql-license
License: GPLv2 with exceptions
# Regression tests take a long time, you can skip 'em with this
%{!?runselftest:%global runselftest 0}
# Upstream has a mirror redirector for downloads, so the URL is hard to
# represent statically. You can get the tarball by following a link from
# http://dev.mysql.com/downloads/mysql/
Source0: mysql-boost-%{version}.tar.gz
# The upstream tarball includes non-free documentation that we cannot ship.
# To remove the non-free documentation, run this script after downloading
# the tarball into the current directory:
# ./generate-tarball.sh $VERSION
# Source1: generate-tarball.sh not used
Source1: mysql.sysconfig
Source2: mysql.init
Source3: my.cnf
Source4: scriptstub.c
Source5: my_config.h
Source6: README.mysql-docs
Source7: README.mysql-license
#Source8: libmysql.version
Source9: mysql-embedded-check.c
Source10: mysql.tmpfiles.d
# systemd files
Source11: mysqld.service
Source12: mysqld-prepare-db-dir
Source13: mysqld-wait-ready
# Working around perl dependency checking bug in rpm FTTB. Remove later.
Source999: filter-requires-mysql.sh
Patch3: mysql-install-test.patch
Patch13: mysqld-nowatch.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: perl, readline-devel, compat-openssl11-devel
BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel, libtirpc-devel, mecab-devel, rpcgen
BuildRequires: gcc gcc-c++ binutils
%if 0%{?fedora} >= 12
BuildRequires: systemtap-sdt-devel >= 1.3
%endif
# make test requires time and ps
BuildRequires: time procps
# Socket and Time::HiRes are needed to run regression tests
BuildRequires: perl(Socket), perl(Time::HiRes)
# This is required old EL4
BuildRequires: bison lz4-devel
Requires: grep, coreutils
Requires: bash
# When rpm 4.9 is universal, this could be cleaned up:
%global __perl_requires %{SOURCE999}
%global __perllib_requires %{SOURCE999}
# Community obsoletes
Provides: MySQL MySQL-community mysql-client MySQL-client
Provides: mysql MySQL
Conflicts: mysql <= 5.6, mariadb <= 5.6, MariaDB <= 5.6, mysql55
# We can use real- prefix to distinguish from other MySQL implementations
# like MariaDB unambiguously
Provides: real-mysql = %{version}-%{release}
Provides: real-mysql%{?_isa} = %{version}-%{release}
# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
#Conflicts: MySQL
# mysql-cluster used to be built from this SRPM, but no more
Obsoletes: mysql-cluster < 5.1.44
# Virtual provides present in upstream's RPM (used by some app)
Provides: mysql-client = %{version}-%{release}
# When rpm 4.9 is universal, this could be cleaned up:
%global __perl_requires %{SOURCE999}
%global __perllib_requires %{SOURCE999}
# By default, patch(1) creates backup files when chunks apply with offsets.
# Turn that off to ensure such files don't get included in RPMs (cf bz#884755).
%global _default_patch_flags --no-backup-if-mismatch
%description
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the standard MySQL client programs and generic MySQL files.
%package libs
Summary: The shared libraries required for MySQL clients
Group: Applications/Databases
Requires: /sbin/ldconfig
%if 0%{?rhel} == 6
Requires: mysqlclient16
%endif
Provides: mysqlclient20
Obsoletes: mysqlclient20 < %{version}-%{release}
Obsoletes: compat-mysql57 <= %{version}
Provides: real-mysql-libs = %{version}-%{release}
Provides: real-mysql-libs%{?_isa} = %{version}-%{release}
# Community obsoletes
Obsoletes: compat-MySQL57 <= %{version}
Provides: mysql-libs MySQL-libs
Obsoletes: mysql-libs < %{version}-%{release}, MySQL-libs < %{version}-%{release}
#Conflicts: mysql55-libs
%if 0%{?rhel} == 5
# EL-5 mysql 5.0.x have no mysql/mysql-libs
# This circular dep. should make update simpler
Requires: %{name}%{?_isa} = %{version}-%{release}
%endif
%description libs
The mysql-libs package provides the essential shared libraries for any
MySQL client program or interface. You will need to install this package
to use any other MySQL package or any clients that need to connect to a
MySQL server.
%package server
Summary: The MySQL server and related files
Group: Applications/Databases
Requires: real-mysql%{?_isa} = %{version}-%{release}
Requires: real-mysql-libs%{?_isa} = %{version}-%{release}
Requires: coreutils
Requires(pre): /usr/sbin/useradd
Requires(post): chkconfig
Requires(preun): chkconfig
%if %{with_systemd}
# We require this to be present for %%{_prefix}/lib/tmpfiles.d
Requires: systemd-units
# Make sure it's there when scriptlets run, too
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
# This is actually needed for the %%triggerun script but Requires(triggerun)
# is not valid. We can use %%post because this particular %%triggerun script
# should fire just after this package is installed.
Requires(post): systemd-sysv
%else
# This is for /sbin/service
Requires(preun): initscripts
Requires(postun): initscripts
%endif
# mysqlhotcopy needs DBI/DBD support
Requires: perl-DBI, perl-DBD-MySQL
Provides: real-mysql-server = %{version}-%{release}
Provides: real-mysql-server%{?_isa} = %{version}-%{release}
# Community Obsoletes
Provides: mysql-server MySQL-server
Obsoletes: mysql-server < %{version}-%{release}, MySQL-server < %{version}-%{release}
Conflicts: mysql-server <= 5.7, mariadb-server <= 5.7, MySQL-server%{?_isa} <= 5.7, mysql55-server
%description server
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.
%package devel
Summary: Files for development of MySQL applications
Group: Applications/Databases
Requires: real-mysql%{?_isa} = %{version}-%{release}
Requires: real-mysql-libs%{?_isa} = %{version}-%{release}
Requires: compat-openssl10-devel%{?_isa}
Provides: real-mysql-devel = %{version}-%{release}
Provides: real-mysql-devel%{?_isa} = %{version}-%{release}
Provides: mysqlclient18-devel = %{version}-%{release}
# Community Obsoletes
Provides: MySQL-devel MySQL-devel-community mysql-devel MySQL-devel
Obsoletes: MySQL-devel < %{version}-%{release}, MySQL-devel-community < %{version}-%{release}, mysql-devel < %{version}-%{release}, MySQL-devel < %{version}-%{release}
Conflicts: pkgconfig(mysqlclient) > 5.7
Conflicts: pkgconfig(mariadb) > 5.7
Conflicts: pkgconfig(mysqlclient) < 5.7
Conflicts: pkgconfig(mariadb) < 5.7
%description devel
MySQL is a multi-user, multi-threaded SQL database server. This
package contains the libraries and header files that are needed for
developing MySQL client applications.
%prep
%setup -q -n mysql-%{version}
# Can't provide this file (by licence)
rm -f Docs/mysql.info
%patch3 -p1
%patch13 -p1
# workaround for upstream bug #56342
rm -f mysql-test/t/ssl_8k_key-master.opt
# upstream has fallen down badly on symbol versioning, do it ourselves
#cp %{SOURCE8} libmysql/libmysql.version
%build
%if 0%{?rhel} == 9
optflags=$(echo "%{optflags}" | sed -e 's/-O2 / /' -e 's/-Wp,-D_FORTIFY_SOURCE=2/ -Wno-missing-field-initializers -Wno-error -Wno-error=odr -Wno-error=free-nonheap-object /' -e 's:-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1::')
%endif
# fail quickly and obviously if user tries to build as root
%if %runselftest
if [ x"`id -u`" = x0 ]; then
echo "mysql's regression tests fail if run as root."
echo "If you really need to build the RPM as root, use"
echo "--define='runselftest 0' to skip the regression tests."
exit 1
fi
%endif
CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
%if 0%{?rhel} >= 8
CFLAGS="$CFLAGS -fno-omit-frame-pointer -fno-use-linker-plugin"
%endif
# MySQL 4.1.10 definitely doesn't work under strict aliasing; also,
# gcc 4.1 breaks MySQL 5.0.16 without -fwrapv
CFLAGS="$CFLAGS -fno-strict-aliasing -fwrapv"
# force PIC mode so that we can build libmysqld.so
CFLAGS="$CFLAGS -fPIC"
# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization
# submitted as bz #529298
%ifarch sparc sparcv9 sparc64
CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" `
%endif
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS
# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
# so we can't use %%{_datadir} and so forth here.
%cmake . -DBUILD_CONFIG=mysql_release \
-DCOMPILATION_COMMENT="MySQL Community Server (GPL)" \
-DFEATURE_SET="community" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DINSTALL_LAYOUT=RPM \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_INFODIR=share/info \
-DINSTALL_LIBDIR="%{_lib}/mysql57" \
-DINSTALL_MANDIR=share/man \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_MYSQLTESTDIR=share/mysql-test \
-DINSTALL_PLUGINDIR="%{_lib}/mysql57/plugin" \
-DINSTALL_SBINDIR=libexec \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SQLBENCHDIR=share \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DMYSQL_DATADIR="/var/lib/mysql" \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DENABLED_LOCAL_INFILE=ON \
%if 0%{?fedora} >= 12
-DENABLE_DTRACE=ON \
%endif
%if 0%{?with_systemd}
-DWITH_SYSTEMD=ON \
%endif
%if 0%{?rhel} >= 9
-DOPENSSL_INCLUDE_DIR=%{_includedir}/openssl11 \
-DOPENSSL_LIBRARY=%{_libdir}/openssl11/libssl.so \
-DCRYPTO_LIBRARY=%{_libdir}/openssl11/libcrypto.so \
%endif
-DWITH_EMBEDDED_SERVER=OFF \
-DWITH_EMBEDDED_SHARED_LIBRARY=OFF \
-DWITH_LZ4=system \
-DWITH_EDITLINE=bundled \
-DWITH_MECAB=system \
-DWITH_READLINE=ON \
-DWITH_INNODB_MEMCACHED=OFF \
-DWITH_ZLIB=system \
%{?ssl_option} \
-DLOCAL_BOOST_DIR=./boost \
-DEDITLINE_INCLUDE_DIR=/usr/include
gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql57\"" %{SOURCE4}
%cmake_build
# # regular build will make libmysqld.a but not libmysqld.so :-(
# mkdir libmysqld/work
# cd libmysqld/work
# # ar -x ../libmysqld.a
# # these result in missing dependencies: (filed upstream as bug 59104)
# rm -f sql_binlog.cc.o rpl_utility.cc.o
# gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \
# *.o \
# %if 0%{?fedora} >= 12
# ../../probes_mysql.o \
# %endif
# -lpthread -laio -lcrypt -lssl -lcrypto -lz -lrt -lstdc++ -ldl -lm -lc
# # this is to check that we built a complete library
# cp %{SOURCE9} .
# ln -s libmysqld.so.0.0.1 libmysqld.so.0
# gcc -I../../include $CFLAGS mysql-embedded-check.c libmysqld.so.0
# LD_LIBRARY_PATH=. ldd ./a.out
# cd ../..
%if %runselftest
# hack to let 32- and 64-bit tests run concurrently on same build machine
case `uname -m` in
ppc64 | s390x | x86_64 | sparc64 )
MTR_BUILD_THREAD=7
;;
*)
MTR_BUILD_THREAD=11
;;
esac
export MTR_BUILD_THREAD
# Sometine, test fails because of this lib.
LD_LIBRARY_PATH=$PWD/libservices
export LD_LIBRARY_PATH
# make test
# The cmake build scripts don't provide any simple way to control the
# options for mysql-test-run, so ignore the make target and just call it
# manually. Nonstandard options chosen are:
# --force to continue tests after a failure
# no retries please
# test SSL with --ssl
# avoid redundant test runs with --binlog-format=mixed
# increase timeouts to prevent unwanted failures during mass rebuilds
cd mysql-test
(
# perl ./mysql-test-run.pl --force --retry=0 --mysqld=--binlog-format=mixed --suite-timeout=720 --testcase-timeout=30
# Run less test to speed up build process
%{__perl} ./mysql-test-run.pl --force --ssl --mysqld=--binlog-format=mixed --suite=main
)
# cmake build scripts will install the var cruft if left alone :-(
rm -rf var
%endif
%install
rm -rf %{buildroot}
%cmake_install
# List the installed tree for RPM package maintenance purposes.
find %{buildroot} -print | sed "s|^%{buildroot}||" | sort > ROOTFILES
# multilib header hacks
# we only apply this to known Red Hat multilib arches, per bug #181335
case `uname -i` in
i386 | x86_64 | ppc | ppc64 | s390 | s390x | sparc | sparc64 )
mv %{buildroot}%{_includedir}/mysql/my_config.h %{buildroot}%{_includedir}/mysql/my_config_`uname -i`.h
install -m 644 %{SOURCE5} %{buildroot}%{_includedir}/mysql/
;;
*)
;;
esac
# cmake generates some completely wacko references to -lprobes_mysql when
# building with dtrace support. Haven't found where to shut that off,
# so resort to this blunt instrument. While at it, let's not reference
# libmysqlclient_r anymore either.
sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \
%{buildroot}%{_bindir}/mysql_config >mysql_config.tmp
cp -f mysql_config.tmp %{buildroot}%{_bindir}/mysql_config
chmod 755 %{buildroot}%{_bindir}/mysql_config
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_libdir}/mysql57/mysql_config
touch %{buildroot}%{_bindir}/mysql_config
mkdir -p %{buildroot}/var/log
touch %{buildroot}/var/log/mysqld.log
mkdir -p %{buildroot}%{_rundir}
install -m 0755 -d %{buildroot}/var/lib/mysql
mkdir -p %{buildroot}/etc/mysql57
install -m 0644 %{SOURCE3} %{buildroot}/etc/mysql57/my.cnf
%if %{with_systemd}
sed -i -e '/user=mysql/d' %{buildroot}/etc/mysql57/my.cnf
%endif
# Remove libmysqld.a, install libmysqld.so
rm -f %{buildroot}%{_libdir}/mysql57/libmysqld.a
# libmysqlclient_r is no more. Upstream tries to replace it with symlinks
# but that really doesn't work (wrong soname in particular). We'll keep
# just the devel libmysqlclient_r.so link, so that rebuilding without any
# source change is enough to get rid of dependency on libmysqlclient_r.
rm -f %{buildroot}%{_libdir}/mysql57/libmysqlclient_r.so*
ln -s libmysqlclient.so %{buildroot}%{_libdir}/mysql57/libmysqlclient_r.so
%if %{with_systemd}
# install systemd unit files and scripts for handling server startup
mkdir -p %{buildroot}%{_unitdir}
#install -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/
install -m 755 %{SOURCE12} %{buildroot}%{_libexecdir}/
install -m 755 %{SOURCE13} %{buildroot}%{_libexecdir}/
mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
install -m 0644 %{SOURCE10} %{buildroot}%{_prefix}/lib/tmpfiles.d/mysql.conf
sed 's@/var/run/mysql@%{_rundir}@g' -i %{buildroot}%{_prefix}/lib/tmpfiles.d/mysql.conf
%else
mkdir -p %{buildroot}/etc/rc.d/init.d
install -m 0755 %{SOURCE2} %{buildroot}/etc/rc.d/init.d/mysqld
# sysconfig is only provided by remi
mkdir -p %{buildroot}/etc/sysconfig
install -m 0644 %{SOURCE1} %{buildroot}/etc/sysconfig/mysqld
%endif
mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/mysql57" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf
# put logrotate script where it needs to be
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
mv ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysqld
chmod 644 %{buildroot}%{_sysconfdir}/logrotate.d/mysqld
# copy additional docs into build tree so %%doc will find them
cp %{SOURCE6} README.mysql-docs
cp %{SOURCE7} README.mysql-license
# Remove pkgconfig fileto avoid conflicts
rm -fr %{buildroot}%{_libdir}/mysql57/pkgconfig
# Remove files that %%doc will install in preferred location
rm -f %{buildroot}/usr/COPYING
rm -f %{buildroot}/usr/README
# Remove files we don't want installed at all
rm -f %{buildroot}/usr/INSTALL-BINARY
rm -f %{buildroot}/usr/docs/ChangeLog
rm -f %{buildroot}/usr/data/mysql/.empty
rm -f %{buildroot}/usr/data/test/.empty
rm -f %{buildroot}%{_datadir}/mysql/solaris/*
rm -fr %{buildroot}%{_datadir}/mysql-test
rm -f %{buildroot}%{_bindir}/mysql_client_test
rm -f %{buildroot}%{_bindir}/mysqlxtest
# should move this to /etc/ ?
rm -f %{buildroot}%{_bindir}/mysqlaccess.conf
rm -f %{buildroot}%{_bindir}/mysql_embedded
rm -f %{buildroot}%{_libdir}/mysql57/*.a
rm -f %{buildroot}%{_datadir}/mysql/binary-configure
rm -f %{buildroot}%{_datadir}/mysql/magic
rm -f %{buildroot}%{_datadir}/mysql/ndb-config-2-node.ini
rm -f %{buildroot}%{_datadir}/mysql/mysql.server
rm -f %{buildroot}%{_datadir}/mysql/mysqld_multi.server
rm -f %{buildroot}%{_mandir}/man1/comp_err.1*
rm -f %{buildroot}%{_mandir}/man1/mysql-stress-test.pl.1*
rm -f %{buildroot}%{_mandir}/man1/mysql-test-run.pl.1*
%clean
rm -rf %{buildroot}
%pre server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6
/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%else
# -N options used on Fedora not available on fedora <= 8 and EL <= 5
/usr/sbin/useradd -M -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%endif
%post devel
%{_sbindir}/update-alternatives --install %{_bindir}/mysql_config \
mysql_config %{_libdir}/mysql57/mysql_config %{__isa_bits}
%post libs
/sbin/ldconfig
%post server
if grep -q skip-bdb /etc/mysql57//my.cnf; then
/usr/bin/perl -p -i -e "s[^skip-bdb][#skip-bdb]gi" /etc/mysql57/my.cnf
fi
datadir=/var/lib/mysql
socketfile="$datadir/mysql.sock"
mypidfile=/var/run/mysqld/mysqld.pid
errorlogfile=/var/log/mysqld.log
start_nonsecure() {
/etc/init.d/mysqld stop || :
# we just want to disable any ^set-variable stuff
if grep -q ^set-variable /etc/mysql57/my.cnf; then
timestamp=$(/bin/date +%m%d%y-%H%M)
cp /etc/mysq57/my.cnf /etc/mysql57/my.cnf-original-$timestamp
/usr/bin/perl -p -i -e "s[^set-variable][#set-variable]gi" /etc/mysql57/my.cnf
/usr/bin/perl -p -i -e "s[^record_buffer][read_buffer_size]gi" /etc/mysql57/my.cnf
/usr/bin/perl -p -i -e "s[^innodb_buffer_pool_read_ahead_rnd][innodb_buffer_pool_read_ahead]gi" /etc/mysql57/my.cnf
/usr/bin/perl -p -i -e "s[^innodb_buffer_pool_read_ahead_seq][innodb_buffer_pool_read_ahead_evicted]gi" /etc/mysql57/my.cnf
fi
# end
/usr/bin/mysqld_safe --datadir="$datadir" --socket="$socketfile" \
--log-error="$errlogfile" --pid-file="$mypidfile" \
--user=mysql --skip-grant-tables >/dev/null 2>&1 &
STARTTIMEOUT=120
while [ $STARTTIMEOUT -gt 0 ]; do
if /usr/bin/mysqladmin ping 2>/dev/null; then break; fi
sleep 1
STARTTIMEOUT=`expr $STARTTIMEOUT - 1`
done
}
run_upgrade() {
start_nonsecure
# black magic 1: mysqlupgrade does not actually able to upgrade
# InnoDB tables, as REPAIR TABLE do not work on them.
# So they need to be re-created.
# OPTIMIZE TABLE does not work on them as well, but does re-creation
# instead. But we actually want to re-create them!
tmpfile=$(/bin/mktemp)
no_repair="The storage engine for the table doesn't support repair"
/usr/bin/mysql_upgrade | grep -B1 "$no_repair" | grep -v "$no_repair" | sed -e "s/^\(.*\)$/OPTIMIZE TABLE \\1;/" 2>&1 > $tmpfile
# black magic 2: after mysql_upgrade, mysqld --skip-grant table
# suddenly wants to authenticate us again..
start_nonsecure
/usr/bin/mysql < $tmpfile
rm -f $tmpfile
/etc/init.d/mysqld stop || :
/etc/init.d/mysqld start || :
}
%if 0%{?systemd_post:1}
%systemd_post mysqld.service
%else
if [ $1 = 1 ]; then
# Initial installation
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add mysqld
%endif
fi
%endif
/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.
%triggerun server -- mysql-server
%if %{with_systemd}
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
%endif
%preun server
%if 0%{?systemd_preun:1}
%systemd_preun mysqld.service
%else
if [ $1 = 0 ]; then
# Package removal, not upgrade
%if %{with_systemd}
/bin/systemctl --no-reload disable mysqld.service >/dev/null 2>&1 || :
/bin/systemctl stop mysqld.service >/dev/null 2>&1 || :
%else
/sbin/service mysqld stop >/dev/null 2>&1
/sbin/chkconfig --del mysqld
%endif
fi
%endif
%postun libs
if [ $1 = 0 ] ; then
/sbin/ldconfig
fi
%postun server
%if 0%{?systemd_postun_with_restart:1}
%systemd_postun_with_restart mysqld.service
%else
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# Package upgrade, not uninstall
/bin/systemctl try-restart mysqld.service >/dev/null 2>&1 || :
fi
%else
if [ $1 -ge 1 ]; then
/sbin/service mysqld condrestart >/dev/null 2>&1 || :
fi
%endif
%endif
%postun devel
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove mysql_config %{_libdir}/mysql57/mysql_config
fi
%files
%defattr(-,root,root)
%doc README README.mysql-license README.mysql-docs
%doc Docs
%{_bindir}/mysql
%{_bindir}/mysqladmin
%{_bindir}/mysqlbinlog
%{_bindir}/mysqlcheck
%{_bindir}/mysqldump
%{_bindir}/mysqlimport
%{_bindir}/mysqlpump
%{_bindir}/mysqlshow
%{_bindir}/mysqlslap
%{_bindir}/my_print_defaults
%{_bindir}/mysql_config_editor
%{_mandir}/man1/mysql.1*
%{_mandir}/man1/mysql_config.1*
%{_mandir}/man1/mysqladmin.1*
%{_mandir}/man1/mysqldump.1*
%{_mandir}/man1/mysqlpump.1*
%{_mandir}/man1/mysqlshow.1*
%{_mandir}/man1/mysqlslap.1*
%{_mandir}/man1/my_print_defaults.1*
%{_mandir}/man1/mysql_config_editor.1*
%{_libdir}/mysql57/mysql_config
%files libs
%config(noreplace) /etc/mysql57/my.cnf
%dir %{_libdir}/mysql57
%{_libdir}/mysql57/libmysqlclient.so.*
/etc/ld.so.conf.d/*
%files server
%defattr(-,root,root)
%doc redhat-linux-build/Docs/INFO_SRC
%doc redhat-linux-build/Docs/INFO_BIN
%{_bindir}/myisamchk
%{_bindir}/myisam_ftdump
%{_bindir}/myisamlog
%{_bindir}/myisampack
%{_bindir}/mysql_install_db
%{_bindir}/mysql_plugin
%{_bindir}/mysql_secure_installation
%{_bindir}/mysql_tzinfo_to_sql
%{_bindir}/mysql_upgrade
%{_bindir}/mysql_ssl_rsa_setup
%{_bindir}/mysqldumpslow
%if 0%{?with_systemd}
%{_bindir}/mysqld_pre_systemd
%else
%{_bindir}/mysqld_multi
%{_bindir}/mysqld_safe
%endif
%{_bindir}/lz4_decompress
%{_bindir}/zlib_decompress
%{_bindir}/mysqltest
%{_bindir}/innochecksum
%{_bindir}/perror
%{_bindir}/replace
%{_bindir}/resolve_stack_dump
%{_bindir}/resolveip
%{_libexecdir}/mysqld
%{_libdir}/mysql57/plugin
%{_mandir}/man1/myisamchk.1*
%{_mandir}/man1/myisamlog.1*
%{_mandir}/man1/myisampack.1*
%{_mandir}/man1/myisam_ftdump.1*
%{_mandir}/man1/mysql.server.1*
%{_mandir}/man1/mysql_install_db.1*
%{_mandir}/man1/mysql_plugin.1*
%{_mandir}/man1/mysql_secure_installation.1*
%{_mandir}/man1/mysql_upgrade.1*
%{_mandir}/man1/mysqldumpslow.1*
%{_mandir}/man1/mysqlbinlog.1*
%{_mandir}/man1/mysqlcheck.1*
%if %{with_systemd}
%exclude %{_mandir}/man1/mysqld_multi.1.gz
%exclude %{_mandir}/man1/mysqld_safe.1.gz
%else
%{_mandir}/man1/mysqld_multi.1*
%{_mandir}/man1/mysqld_safe.1*
%endif
%{_mandir}/man1/lz4_decompress.1.*
%{_mandir}/man1/zlib_decompress.1.*
%{_mandir}/man1/mysql_config_editor.1.*
%{_mandir}/man1/mysqlimport.1*
%{_mandir}/man1/mysqlman.1*
%{_mandir}/man1/innochecksum.1*
%{_mandir}/man1/perror.1*
%{_mandir}/man1/replace.1*
%{_mandir}/man1/resolve_stack_dump.1*
%{_mandir}/man1/resolveip.1*
%{_mandir}/man1/mysql_tzinfo_to_sql.1*
%{_mandir}/man1/mysql_ssl_rsa_setup.1*
%{_mandir}/man8/mysqld.8*
%{_datadir}/mysql/errmsg-utf8.txt
%{_datadir}/mysql/fill_help_tables.sql
%{_datadir}/mysql/mysql_system_tables.sql
%{_datadir}/mysql/mysql_system_tables_data.sql
%{_datadir}/mysql/mysql_test_data_timezone.sql
%{_datadir}/mysql/dictionary.txt
%{_datadir}/mysql/charsets/
%{_datadir}/mysql/*/errmsg.sys
%{_datadir}/mysql/install_rewriter.sql
%{_datadir}/mysql/uninstall_rewriter.sql
%{_datadir}/mysql/mysql_security_commands.sql
%{_datadir}/mysql/mysql_sys_schema.sql
%{_datadir}/mysql/innodb_memcached_config.sql
%if %{with_systemd}
%{_unitdir}/mysqld@.service
%{_unitdir}/mysqld.service
%{_libexecdir}/mysqld-prepare-db-dir
%{_libexecdir}/mysqld-wait-ready
%{_prefix}/lib/tmpfiles.d/mysql.conf
%else
/etc/rc.d/init.d/mysqld
%config(noreplace) /etc/sysconfig/mysqld
%endif
%attr(0755,mysql,mysql) %dir %{_rundir}
%attr(0755,mysql,mysql) %dir /var/lib/mysql
%attr(0640,mysql,mysql) %config(noreplace) %verify(not md5 size mtime) /var/log/mysqld.log
%config(noreplace) %{_sysconfdir}/logrotate.d/mysqld
%files devel
%{_bindir}/mysql_config
#{_libdir}/mysql/mysql_config
%defattr(-,root,root)
%{_includedir}/mysql
%{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql57/libmysqlclient.so
%{_libdir}/mysql57/libmysqlclient_r.so
%changelog
* Tue Mar 1 2022 Raven <raven@sysadmins.ws> - 5.7.36-1
- initial release