Remove SysVInit stuff

Clean up the SPECfile
This commit is contained in:
Michal Schorm 2019-05-01 03:40:02 +02:00 committed by mschorm
parent 7ee5c2cf8a
commit 7e955cd423
7 changed files with 13 additions and 358 deletions

View File

@ -1,7 +1,7 @@
diff -rup mysql-5.7.8.orig/scripts/CMakeLists.txt mysql-5.7.8/scripts/CMakeLists.txt
--- mysql-5.7.8.orig/scripts/CMakeLists.txt 2015-07-20 14:25:08.000000000 +0200
+++ mysql-5.7.8/scripts/CMakeLists.txt 2015-09-24 10:47:01.733914088 +0200
@@ -483,6 +483,35 @@ ELSE()
@@ -483,6 +483,32 @@ ELSE()
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
ENDIF()
@ -12,13 +12,10 @@ diff -rup mysql-5.7.8.orig/scripts/CMakeLists.txt mysql-5.7.8/scripts/CMakeLists
+ mysql.service
+ mysql@.service
+ mysql-prepare-db-dir
+ mysql-wait-ready
+ mysql-wait-stop
+ mysql-check-socket
+ mysql-check-upgrade
+ mysql-scripts-common
+ mysql_config_multilib
+ mysql.init
+ my.cnf
+ server.cnf
+ )

View File

@ -17,9 +17,6 @@
%global _pkgdocdirname %{pkg_name}%{!?_pkgdocdir:-%{version}}
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{pkg_name}-%{version}}
# Use Full RELRO for all binaries (RHBZ#1092548)
%global _hardened_build 1
# 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
@ -42,25 +39,12 @@
# For deep debugging we need to build binaries with extra debug info
%bcond_with debug
# Include files for SysV init or systemd
%if 0%{?fedora} || 0%{?rhel} >= 7
%bcond_without init_systemd
%bcond_with init_sysv
%global daemondir %{_unitdir}
%else
%bcond_with init_systemd
%bcond_without init_sysv
%global daemondir %{_sysconfdir}/rc.d/init.d
%endif
# Include files for systemd
%global daemon_name mysqld
%global daemon_no_prefix mysqld
# Directory for storing pid file
%if 0%{?rhel} == 6
%global pidfiledir %{_localstatedir}/run/%{daemon_name}
%else
%global pidfiledir %{_rundir}/%{daemon_name}
%endif
# We define some system's well known locations here so we can use them easily
# later when building to another location (like SCL)
@ -83,7 +67,7 @@
Name: community-mysql
Version: 8.0.16
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Summary: MySQL client programs and shared libraries
URL: http://www.mysql.com
@ -99,13 +83,10 @@ Source7: README.mysql-license
Source10: mysql.tmpfiles.d.in
Source11: mysql.service.in
Source12: mysql-prepare-db-dir.sh
Source13: mysql-wait-ready.sh
Source14: mysql-check-socket.sh
Source15: mysql-scripts-common.sh
Source16: mysql-check-upgrade.sh
Source17: mysql-wait-stop.sh
Source18: mysql@.service.in
Source19: mysql.init.in
# To track rpmlint warnings
Source30: mysql-5.6.10-rpmlintrc
# Configuration for server
@ -176,7 +157,7 @@ BuildRequires: perl(Socket)
BuildRequires: perl(Sys::Hostname)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
%{?with_init_systemd:BuildRequires: systemd}
BuildRequires: systemd
@ -197,14 +178,8 @@ Provides: mysql-compat-client%{?_isa} = %{sameevr}
Obsoletes: mysql-cluster < 5.1.44
# Filtering: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
%if 0%{?fedora} || 0%{?rhel} > 6
%global __requires_exclude ^perl\\((hostnames|lib::mtr|lib::v1|mtr_|My::)
%global __provides_exclude_from ^(%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\\.so)$
%else
%filter_from_requires /perl(\(hostnames\|lib::mtr\|lib::v1\|mtr_\|My::\)/d
%filter_provides_in -P (%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\.so)
%filter_setup
%endif
%description
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
@ -278,12 +253,10 @@ Requires: %{name}-errmsg%{?_isa} = %{sameevr}
%{?mecab:Requires: mecab-ipadic}
Requires: coreutils
Requires(pre): /usr/sbin/useradd
%if %{with init_systemd}
# We require this to be present for %%{_tmpfilesdir}
Requires: systemd
# Make sure it's there when scriptlets run, too
%{?systemd_requires: %systemd_requires}
%endif
# SYS_NICE capabilities; #1540946
Recommends: libcap
# semanage
@ -404,8 +377,8 @@ add_test perfschema.setup_objects missing hw on arm32
popd
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE31} scripts
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \
%{SOURCE14} %{SOURCE15} %{SOURCE17} %{SOURCE18} %{SOURCE31} scripts
%build
# fail quickly and obviously if user tries to build as root
@ -451,11 +424,9 @@ cmake .. \
-DMYSQL_DATADIR="%{dbdatadir}" \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DENABLED_LOCAL_INFILE=ON \
%if %{with init_systemd}
-DWITH_SYSTEMD=1 \
-DSYSTEMD_SERVICE_NAME="%{daemon_name}" \
-DSYSTEMD_PID_DIR="%{pidfiledir}" \
%endif
-DWITH_INNODB_MEMCACHED=ON \
%ifnarch aarch64 %{arm} s390 s390x
-DWITH_NUMA=ON \
@ -472,7 +443,7 @@ cmake .. \
%{?with_debug: -DWITH_DEBUG=1}\
%{?with_debug: -DMYSQL_MAINTAINER_MODE=0}\
-DTMPDIR=/var/tmp \
%{?_hardened_build:-DWITH_MYSQLD_LDFLAGS="-pie -Wl,-z,relro,-z,now"}
-DWITH_MYSQLD_LDFLAGS="-pie -Wl,-z,relro,-z,now"
cmake .. -LAH
@ -508,24 +479,15 @@ install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
%endif
# install systemd unit files and scripts for handling server startup
%if %{with init_systemd}
install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service
install -D -p -m 644 scripts/mysql@.service %{buildroot}%{_unitdir}/%{daemon_name}@.service
install -D -p -m 0644 scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf
rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf
%endif
# install SysV init script
%if %{with init_sysv}
install -D -p -m 755 scripts/mysql.init %{buildroot}%{daemondir}/%{daemon_name}
install -p -m 755 scripts/mysql-wait-ready %{buildroot}%{_libexecdir}/mysql-wait-ready
%endif
# helper scripts for service starting
install -D -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
install -p -m 755 scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop
install -p -m 755 scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket
install -p -m 755 scripts/mysql-check-upgrade %{buildroot}%{_libexecdir}/mysql-check-upgrade
install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common
install -D -p -m 0644 scripts/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf
@ -641,38 +603,16 @@ popd
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%post server
%if %{with init_systemd}
%systemd_post %{daemon_name}.service
%endif
%if %{with init_sysv}
if [ $1 = 1 ]; then
/sbin/chkconfig --add %{daemon_name}
fi
%endif
if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then
install /dev/null -m0640 -omysql -gmysql "%{logfile}"
fi
%preun server
%if %{with init_systemd}
%systemd_preun %{daemon_name}.service
%endif
%if %{with init_sysv}
if [ $1 = 0 ]; then
/sbin/service %{daemon_name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{daemon_name}
fi
%endif
%postun server
%if %{with init_systemd}
%systemd_postun_with_restart %{daemon_name}.service
%endif
%if %{with init_sysv}
if [ $1 -ge 1 ]; then
/sbin/service %{daemon_name} condrestart >/dev/null 2>&1 || :
fi
%endif
%if %{with client}
%files
@ -763,12 +703,7 @@ fi
%{_bindir}/mysql_ssl_rsa_setup
%{_bindir}/mysql_tzinfo_to_sql
%{_bindir}/mysql_upgrade
%if %{with init_systemd}
%{_bindir}/mysqld_pre_systemd
%else
%{_bindir}/mysqld_multi
%{_bindir}/mysqld_safe
%endif
%{_bindir}/mysqldumpslow
%{_bindir}/innochecksum
%{_bindir}/perror
@ -799,13 +734,8 @@ fi
%{_mandir}/man1/mysql_tzinfo_to_sql.1*
%{_mandir}/man1/mysql_upgrade.1*
%{_mandir}/man1/mysqldumpslow.1*
%if %{with init_systemd}
%exclude %{_mandir}/man1/mysqld_multi.1*
%exclude %{_mandir}/man1/mysqld_safe.1*
%else
%{_mandir}/man1/mysqld_multi.1*
%{_mandir}/man1/mysqld_safe.1*
%endif
%{_mandir}/man1/mysqlman.1*
%{_mandir}/man1/innochecksum.1*
%{_mandir}/man1/perror.1*
@ -816,17 +746,13 @@ fi
%{_datadir}/%{pkg_name}/dictionary.txt
%{_datadir}/%{pkg_name}/*.sql
%{daemondir}/%{daemon_name}*
%{_unitdir}/%{daemon_name}*
%{_libexecdir}/mysql-prepare-db-dir
%if %{with init_sysv}
%{_libexecdir}/mysql-wait-ready
%endif
%{_libexecdir}/mysql-wait-stop
%{_libexecdir}/mysql-check-socket
%{_libexecdir}/mysql-check-upgrade
%{_libexecdir}/mysql-scripts-common
%{?with_init_systemd:%{_tmpfilesdir}/%{daemon_name}.conf}
%{_tmpfilesdir}/%{daemon_name}.conf
%attr(0755,mysql,mysql) %dir %{dbdatadir}
%attr(0750,mysql,mysql) %dir %{_localstatedir}/lib/mysql-files
%attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring
@ -858,6 +784,10 @@ fi
%endif
%changelog
* Wed May 01 2019 Michal Schorm <mschorm@redhat.com> - 8.0.16-2
- Remove SysVInit stuff, no longer needed
- Clean up the SPECfile
* Fri Apr 26 2019 Lars Tangvald <lars.tangvald@oracle.com> - 8.0.16-1
- Update to MySQL 8.0.16
- Rediff sharedir patch

View File

@ -1,39 +0,0 @@
#!/bin/sh
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
upgrade_info_file="$datadir/mysql_upgrade_info"
version=0
# get version as integer from mysql_upgrade_info file
if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then
version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/')
version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/')
if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then
version=$((version_major*100+version_minor))
fi
fi
# compute current version as integer
thisversion=$((@MAJOR_VERSION@*100+@MINOR_VERSION@))
# provide warning in cases we should run mysql_upgrade
if [ $version -ne $thisversion ] ; then
# give extra warning if some version seems to be skipped
if [ $version -gt 0 ] && [ $version -lt 505 ] ; then
echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2
fi
cat <<EOF >&2
The datadir located at $datadir needs to be upgraded using 'mysql_upgrade' tool. This can be done using the following steps:
1. Back-up your data before with 'mysql_upgrade'
2. Start the database daemon using 'service @DAEMON_NAME@ start'
3. Run 'mysql_upgrade' with a database user that has sufficient privileges
Read more about 'mysql_upgrade' usage at:
http://dev.mysql.com/doc/refman/5.6/en/mysql-upgrade.html
EOF
fi
exit 0

View File

@ -1,45 +0,0 @@
#!/bin/sh
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
# This script waits for mysqld to be ready to accept connections
# (which can be many seconds or even minutes after launch, if there's
# a lot of crash-recovery work to do).
# Running this as ExecStartPost is useful so that services declared as
# "After mysqld" won't be started until the database is really ready.
if [ $# -ne 1 ] ; then
echo "You need to pass daemon pid as an argument for this script."
exit 20
fi
# Service file passes us the daemon's PID (actually, mysqld_safe's PID)
daemon_pid="$1"
# Wait for the server to come up or for the mysqld process to disappear
ret=0
while /bin/true; do
# Check process still exists
if ! [ -d "/proc/${daemon_pid}" ] ; then
ret=1
break
fi
RESPONSE=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
mret=$?
if [ $mret -eq 0 ] ; then
break
fi
# exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
# anything else suggests a configuration error
if [ $mret -ne 1 -a $mret -ne 11 ]; then
echo "Cannot check for @NICE_PROJECT_NAME@ Daemon startup because of mysqladmin failure." >&2
ret=$mret
break
fi
# "Access denied" also means the server is alive
echo "$RESPONSE" | grep -q "Access denied for user" && break
sleep 1
done
exit $ret

View File

@ -1,186 +0,0 @@
#!/bin/sh
#
# @DAEMON_NAME@ This shell script takes care of starting and stopping
# the MySQL subsystem (mysqld).
#
# chkconfig: - 64 36
# description: MySQL database server.
# processname: mysqld
# config: @sysconfdir@/my.cnf
# pidfile: /var/run/@DAEMON_NAME@/@DAEMON_NO_PREFIX@.pid
### BEGIN INIT INFO
# Provides: mysqld
# Required-Start: $local_fs $remote_fs $network $named $syslog $time
# Required-Stop: $local_fs $remote_fs $network $named $syslog $time
# Short-Description: start and stop MySQL server
# Description: MySQL database server
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
exec="@bindir@/mysqld_safe"
prog="@DAEMON_NAME@"
# Set timeouts here so they can be overridden from @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@
STARTTIMEOUT=300
STOPTIMEOUT=60
# User and group the daemon will run under
MYUSER=mysql
MYGROUP=mysql
# Edit the following file in order to re-write some of the environment
# variables defined above, like $STARTTIMEOUT, $STOPTIMEOUT, $exec
[ -e @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@ ] && . @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@
lockfile=/var/lock/subsys/$prog
# get options from my.cnf
source "@libexecdir@/mysql-scripts-common"
start(){
[ -x $exec ] || exit 5
# check permissions
if ! touch $(dirname $socketfile) &>/dev/null ; then
action $"Starting $prog: " /bin/false
return 4
fi
# check to see if it's already running
MYSQLDRUNNING=0
if [ -f "$pidfile" ]; then
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -n "$MYSQLPID" ] && [ -d "/proc/$MYSQLPID" ] ; then
MYSQLDRUNNING=1
fi
fi
RESPONSE=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
if [ $MYSQLDRUNNING = 1 ] && [ $? = 0 ]; then
# already running, do nothing
action $"Starting $prog: " /bin/true
ret=0
elif [ $MYSQLDRUNNING = 1 ] && echo "$RESPONSE" | grep -q "Access denied for user"
then
# already running, do nothing
action $"Starting $prog: " /bin/true
ret=0
else
@libexecdir@/mysql-check-socket || return 1
su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP" || return 4
# Pass all the options determined above, to ensure consistent behavior.
# In many cases mysqld_safe would arrive at the same conclusions anyway
# but we need to be sure. (An exception is that we don't force the
# log-error setting, since this script doesn't really depend on that,
# and some users might prefer to configure logging to syslog.)
# Note: set --basedir to prevent probes that might trigger SELinux
# alarms, per bug #547485
su - $MYUSER -s /bin/bash -c "$exec --datadir='$datadir' --socket='$socketfile' \
--pid-file='$pidfile' \
--basedir=@prefix@ --user=$MYUSER" >/dev/null 2>&1 &
safe_pid=$!
# Wait until the daemon is up
su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-wait-ready '$safe_pid'"
ret=$?
if [ $ret -eq 0 ]; then
action $"Starting $prog: " /bin/true
chmod o+r $pidfile >/dev/null 2>&1
touch $lockfile
else
action $"Starting $prog: " /bin/false
fi
fi
return $ret
}
stop(){
if [ ! -f "$pidfile" ]; then
# not running; per LSB standards this is "ok"
action $"Stopping $prog: " /bin/true
return 0
fi
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -n "$MYSQLPID" ]; then
if ! [ -d "/proc/$MYSQLPID" ] ; then
# process doesn't run anymore
action $"Stopping $prog: " /bin/true
return 0
fi
/bin/kill "$MYSQLPID" >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
TIMEOUT="$STOPTIMEOUT"
while [ $TIMEOUT -gt 0 ]; do
/bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
sleep 1
let TIMEOUT=${TIMEOUT}-1
done
if [ $TIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1
action $"Stopping $prog: " /bin/false
else
rm -f $lockfile
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
fi
else
# kill command failed, probably insufficient permissions
action $"Stopping $prog: " /bin/false
ret=4
fi
else
# failed to read pidfile, probably insufficient permissions
action $"Stopping $prog: " /bin/false
ret=4
fi
return $ret
}
restart(){
stop
start
}
condrestart(){
[ -e $lockfile ] && restart || :
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p "$pidfile" $prog
;;
restart)
restart
;;
condrestart|try-restart)
condrestart
;;
reload)
exit 3
;;
force-reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?

View File

@ -40,7 +40,6 @@ ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --basedir=@prefix@
ExecStartPost=@libexecdir@/mysql-check-upgrade
ExecStopPost=@libexecdir@/mysql-wait-stop
# Give a reasonable amount of time for the server to start up/shut down

View File

@ -40,7 +40,6 @@ ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@
ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I
ExecStopPost=@libexecdir@/mysql-wait-stop --defaults-group-suffix=.%I
# Give a reasonable amount of time for the server to start up/shut down