SHA256
1
0
forked from pool/mariadb

Accepting request 316015 from server:database

1

OBS-URL: https://build.opensuse.org/request/show/316015
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mariadb?expand=0&rev=48
This commit is contained in:
Stephan Kulow 2015-07-19 09:45:12 +00:00 committed by Git OBS Bridge
commit c8d4232ae9
19 changed files with 722 additions and 1738 deletions

View File

@ -45,14 +45,6 @@ following line to your /etc/my.cnf into section [mysqld]:
core-file
Note: this unfortunatelly doesn't work in SUSE Linux 10.1 and older.
On these systems, you need to run safe_mysqld directly under user
mysql:
su - mysql
mysqld_safe --socket=/var/lib/mysql/mysql.sock \
--datadir=/var/lib/mysql --core-file &
The core file will be written to the /var/lib/mysql/ directory. I
suggest setting the kernel variable kernel.core_uses_pid to 1
@ -64,31 +56,19 @@ multiple crashes.
After you got the core file, install the gdb and mysql-debuginfo
packages and run
gdb /usr/sbin/mysqld /var/lib/mysql/core
gdb /usr/sbin/mysqld /var/lib/mysql/<core>
(gdb) bt
Replace mysqld with the mysqld version you used (mysqld, mysqld-max)
and core with the actual name of the coredump.
Replace the <core> with the actual name of the coredump.
3) Trace files
--------------
Start mysqld using following command:
$ MYSQLD_DEBUG=yes rcmysql start
The init script will then start mysqld and add the --core-file,
--log and --debug options for you. The query log will be stored in
/var/lib/mysql/myqld-query.log
and the trace file in
/var/lib/mysql/mysqld.trace
If you don't like the options set by the init script, just put your own
into /etc/my.cnf and the init script will honor them.
The trace file will contain various debug information and function
calls/returns and will become _extremly_ huge after a while, so don't
attach it to bugzilla unless requested.
Add the following line to your /etc/my.cnf into section [mysqld]:
stack-trace
The trace file will be then written to /var/lib/mysql directory.

View File

@ -9,7 +9,7 @@ PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h misibook password 'new-password'
'/usr/bin/mysqladmin' -u root -h <hostname> password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'

View File

@ -1,5 +1,8 @@
<constraints>
<hardware>
<physicalmemory>
<size unit="M">5000</size>
</physicalmemory>
<disk>
<size unit="G">13</size>
</disk>

View File

@ -1,49 +0,0 @@
EXTRA_FLAGS="-Wno-unused-but-set-variable -fno-strict-aliasing -Wno-unused-parameter"
# Mariadb devs seems to fall in love with -Werror option
EXTRA_FLAGS="${EXTRA_FLAGS} -Wno-error"
%ifarch ppc64
EXTRA_FLAGS="${EXTRA_FLAGS} -mminimal-toc"
%endif
export CFLAGS="%{optflags} -DOPENSSL_LOAD_CONF -DPIC -fPIC -DFORCE_INIT_OF_VARS $EXTRA_FLAGS"
export CXXFLAGS="$CFLAGS -felide-constructors"
%cmake -DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBEVENT=system \
-DWITH_JEMALLOC=auto \
-DWITH_READLINE=0 \
-DWITH_LIBEDIT=0 \
-DINSTALL_LAYOUT=RPM \
-DMYSQL_UNIX_ADDR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_UNIX_ADDRDIR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_MYSQLSHAREDIR=share/%{name} \
-DWITH_COMMENT="openSUSE MySQL rpm" \
-DWITH_EXTRA_CHARSET=all \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
%if 0%{with_oqgraph} > 0
-DWITH_OQGRAPH_STORAGE_ENGINE=1 \
%endif
%if 0%{with_cassandra} > 0
-DWITH_CASSANDRA_STORAGE_ENGINE=1 \
%endif
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_CSV_STORAGE_ENGINE=1 \
-DWITH_HANDLERSOCKET_STORAGE_ENGINE=1 \
-DWITH_EMBEDDED_SERVER=true \
-DCOMPILATION_COMMENT="openSUSE package" \
-DDENABLE_DOWNLOADS=false \
-DINSTALL_PLUGINDIR_RPM="%{_lib}/mysql/plugin" \
-DINSTALL_LIBDIR_RPM="%{_lib}" \
-DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$CFLAGS" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_SQLBENCHDIR=share \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-Wno-dev "$@" ..
make %{?_smp_mflags}
nm --numeric-sort sql/mysqld > sql/mysqld.sym

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c96c09b6dff46a9d93d48ae6e5fdbf83469abbafd1191f2eef92f452b17ac4f
size 218
oid sha256:d06d18f5c8475f73d299dfe2492b37d721f993751e7ac487cc24d589972ec8ea
size 313

View File

@ -1,148 +0,0 @@
%cmake_install benchdir_root=/usr/share/
install -m 644 build/sql/mysqld.sym %buildroot%_libdir/mysql/mysqld.sym
# remove handler socket client
rm -f %buildroot%_libdir/libhsclient*
rm -f %buildroot%_bindir/hsclient*
[ \! -f "%{buildroot}%{_bindir}/mytop" ] || mv %{buildroot}%{_bindir}/mytop %{buildroot}%{_bindir}/%{name}_mytop
rm -f %buildroot%_libdir/mysql/plugin/handlersocket.so
# remove most static libs (FIXME: don't build them at all...)
[ \! -f "%buildroot%_libdir/"libmysqld.a ] || mv "%buildroot%_libdir/"libmysqld.a "%buildroot%_libdir/"libmysqld.static
rm -f %buildroot%_libdir/*.a
[ \! -f "%buildroot%_libdir/"libmysqld.static ] || mv "%buildroot%_libdir/"libmysqld.static "%buildroot%_libdir/"libmysqld.a
rm -f %buildroot%_libdir/mysql/{,plugin}/*.{a,la}
rm -f %buildroot%_libdir/mysql/libndbclient.*
rm -f %buildroot%_libdir/mysql/plugin/debug_key_management.so
rm -f %{buildroot}/usr/share/mysql-test/{mysql-test-run,mtr}
rm -f %{buildroot}/usr/share/mysql/{binary-configure,errmsg-utf8.txt,magic,mysql-log-rotate,mysql*.server}
rm -f %{buildroot}%{_libdir}/mysql/plugin/daemon_example.ini
ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mtr
ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mysql-test-run
mv %{buildroot}/usr/share/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir}
# generate filelist for binaries and their manpages
filelist()
{
echo '%%defattr(-, root, root)'
pushd %buildroot >/dev/null
for i; do
if test -e usr/sbin/"$i"; then
echo /usr/sbin/"$i"
fi
if test -e usr/bin/"$i"; then
echo /usr/bin/"$i"
fi
if test -d usr/share/*/"$i"; then
echo "/`echo usr/share/*/"$i"`"
fi
if test -n "`ls -1 %buildroot$i 2> /dev/null`"; then
echo "$i"
fi
if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then
echo "%%doc %_mandir/*/$i.[1-9]*"
fi
done
popd >/dev/null
}
filelist innochecksum my_print_defaults myisam_ftdump myisamchk myisamlog myisampack mysql_fix_extensions mysql_fix_privilege_tables mysql_install_db mysql_secure_installation mysql_upgrade mysqlbug mysqld mysqld_multi mysqld_safe mysqlbinlog mysqldumpslow mysqlmanager mroonga resolve_stack_dump resolveip {m,}aria_chk {m,}aria_dump_log {m,}aria_ftdump {m,}aria_pack {m,}aria_read_log xtstat tokuftdump >mysql.files
filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow mysql_config_editor >mysql-client.files
filelist mysql_config /usr/share/pkgconfig/mariadb.pc >libmysqlclient-devel.files
filelist mysqlslap >mysql-bench.files
filelist mysql_client_test mysql_client_test_embedded mysql_waitpid mysqltest mysqltest_embedded >mysql-test.files
# all binaries that don't need to be in a "default" install (mysql.rpm +
# mysql-client.rpm)
filelist msql2mysql mysql_plugin mysql_convert_table_format mysql_find_rows mysql_setpermission mysql_tzinfo_to_sql mysql_zap mysqlaccess mysqlhotcopy perror replace mysql_embedded %{name}_mytop hsclient %{_bindir}/wsrep* /usr/share/mysql/wsrep_notify >mysql-tools.files
filelist ndbd ndbmtd ndbd_redo_log_reader >mysql-ndb-storage.files
filelist ndb_mgmd >mysql-ndb-management.files
filelist ndb_{config,desc,error_reporter,mgm,print_backup_file,print_schema_file,print_sys_file,restore,select_all,select_count,show_tables,size.pl,test_platform,waiter} >mysql-ndb-tools.files
filelist ndb_{cpcd,delete_all,drop_index,index_stat,print_file,redo_log_reader,drop_table} ndbinfo_select_all memcached >mysql-ndb-extra.files
[ -z "`ls -1 "%buildroot/usr/share/mysql/"*.ini`" ] || echo '/usr/share/mysql/*.ini' >> mysql.files
[ -z "`ls -1 "%buildroot/usr/share/mysql/"*.cnf`" ] || echo '/usr/share/mysql/*.cnf' >> mysql.files
[ \! -f "%buildroot/usr/share/%name"/dictionary.txt ] || echo "/usr/share/%name/dictionary.txt" >> mysql.files
errmsg_list()
{
echo '%%defattr(-, root, root)'
pushd %buildroot >/dev/null
for f in usr/share/%{name}/*; do
if test -e $f/errmsg.sys; then
echo "%%dir /$f"
fi
done
echo /usr/share/%{name}/errmsg-utf8.txt
popd >/dev/null
}
errmsg_list > errormessages.files
### files not installed by make install
# Create directory structure
DOCS=(COPYING README EXCEPTIONS-CLIENT %_sourcedir/README.debug %_sourcedir/README.SUSE plugin/daemon_example/daemon_example.ini)
DOCDIR=%buildroot%_defaultdocdir/%name
install -d -m 755 ${DOCDIR}
install -d -m 755 %buildroot/etc/logrotate.d
install -m 644 build/support-files/mysql-log-rotate %buildroot/etc/logrotate.d/mysql
install -m 660 %{S:14} %buildroot/etc/my.cnf
[ \! -f scripts/mysqlaccess.conf ] || install -m 640 scripts/mysqlaccess.conf %buildroot/etc/mysqlaccess.conf
for i in "${DOCS[@]}"; do
install -m 644 "${i}" "${DOCDIR}" || true
done
install -D -m 755 %_sourcedir/rc.mysql.systemd '%buildroot'/usr/lib/mysql/rcmysql
sed -i 's|@MYSQLVER@|%{version}|' '%buildroot'/usr/lib/mysql/rcmysql
ln -sf service '%buildroot'/usr/sbin/rcmysql
install -D -m 644 %_sourcedir/mysql.service '%buildroot'/usr/lib/systemd/system/mysql.service
sed -i 's|doc/packages/mysql|doc/packages/%{name}|g' '%buildroot'/usr/lib/mysql/rcmysql
rm -rf '%buildroot'/etc/init.d
# SuSEfirewall service description
install -D -m 644 %_sourcedir/mysql.SuSEfirewall2 \
%buildroot/etc/sysconfig/SuSEfirewall2.d/services/mysql
# testsuite
mkdir -p '%buildroot'/usr/share/mysql-test/
install -m 755 suse-test-run '%buildroot'/usr/share/mysql-test/
mkdir '%buildroot'/usr/share/mysql-test/var
# Final fixes
find '%buildroot'/usr/share/mysql-test -name '*.orig' -delete
%fdupes -s '%buildroot'/usr/share/mysql-test
fdupes -q -n -r '%buildroot'/usr/share/mysql-test
dos2unixConversion() {
%{__sed} -i 's/\r//g' "$1"
}
for i in `grep -Rl '\r' '%buildroot'/usr/share/sql-bench`; do
dos2unixConversion "$i"
done
%if ! 0%{preferred} > 0
cat libmysqlclient-devel.files | sed 's|%%doc\ ||' | while read tmp; do
cd '%buildroot'
rm -f ."$tmp"
done
rm -rf '%buildroot'/%_libdir/libmysqld.*
rm -rf '%buildroot'/%_libdir/{*.la,*.so,*.a}
rm -rf '%buildroot'/%_datadir/man/*/mysql_config.1*
rm -rf '%buildroot'/%_includedir
rm -rf '%buildroot'/%_datadir/aclocal
%endif
ln -s mysqlcheck '%buildroot'%_bindir/mysqlrepair
ln -s mysqlcheck '%buildroot'%_bindir/mysqlanalyze
ln -s mysqlcheck '%buildroot'%_bindir/mysqloptimize
if [ -f '%buildroot'/usr/bin/mysqlaccess.conf ]; then
mv '%buildroot'/usr/bin/mysqlaccess.conf '%buildroot'/etc/mysqlaccess.conf
fi
[ \! -f '%buildroot'/etc/mysqlaccess.conf ] || echo '%config(noreplace) %attr(0640, root, mysql) /etc/mysqlaccess.conf' >> mysql-client.files
rm -rf '%buildroot'/etc/my.cnf.d
mkdir -p '%buildroot'/etc/my.cnf.d
bzip2 -cd '%_sourcedir'/configuration-tweaks.tar.bz2 | tar -C '%buildroot'/etc/my.cnf.d -xvf -
%if %have_info < 1
[ -z "`ls '%buildroot'/usr/share/info/mysql.info* 2> /dev/null`" ] || rm -f '%buildroot'/usr/share/info/mysql.info*
%endif
[ -z "`ls '%buildroot'/usr/share/mysql-test/suite/innodb/t/*.zip`" ] || chmod a-x '%buildroot'/usr/share/mysql-test/suite/innodb/t/*.zip
if [ "`ls '%buildroot'%_libdir/mysql/plugin/dialog*.so 2> /dev/null`" ]; then
echo '%%dir %%_libdir/mysql' >> mysql-client.files
echo '%%dir %%_libdir/mysql/plugin' >> mysql-client.files
echo '%%_libdir/mysql/plugin/dialog*.so' >> mysql-client.files
fi
if [ %{_defaultdocdir} \!= /usr/share/doc ]; then
rm -rf '%buildroot'/usr/share/doc/{mysql,mariadb}*
fi
if [ %{name} \!= mysql ]; then
rm -rf '%buildroot'/usr/share/doc/mysql
fi
if [ %{name} \!= mariadb ]; then
rm -rf '%buildroot'/usr/share/doc/mariadb
fi
rm -f '%buildroot'/usr/share/doc/* 2> /dev/null || true
rm -rf '%buildroot'/usr/share/mysql/{solaris,SELinux}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9cd394e99942c3700b13f2bf126895fe587e668bfcaffcfd81f0cd878fc19311
size 55989700

3
mariadb-10.0.20.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3a4f6963c794977af5d5fd9ec06a337a2ad556b3a287196fddbd2243c1388b7b
size 56241178

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Sat Jul 11 12:25:05 UTC 2015 - tchvatal@suse.com
- Sync to git state, fixes bnc#937754 too
-------------------------------------------------------------------
Tue Jul 7 09:24:09 UTC 2015 - tchvatal@suse.com
- Sync to git state fixing few triv issues
-------------------------------------------------------------------
Fri Jun 26 07:41:39 UTC 2015 - tchvatal@suse.com
- Enable testsuite
-------------------------------------------------------------------
Thu Jun 25 13:50:12 UTC 2015 - tchvatal@suse.com
- Update to 10.0.20:
https://mariadb.com/kb/en/mariadb/mariadb-10020-release-notes/
* Fixes bnc#934789 Logjam Attack using 512bit dh groups in ssl
- Sync the package to git state, redoing initscripts to be more
robust
-------------------------------------------------------------------
Tue Jun 23 13:16:03 UTC 2015 - tchvatal@suse.com
- Update to 10.0.19, sync to git state of repository:
https://mariadb.com/kb/en/mariadb/mariadb-10019-release-notes/
-------------------------------------------------------------------
Tue Apr 14 13:42:54 UTC 2015 - michal.hrusecky@opensuse.org
@ -15,6 +45,11 @@ Mon Mar 23 23:24:11 UTC 2015 - dvaleev@suse.com
- Adjust _constraints. 11GB is not enough for ppc64 builds,
increase to 13GB
-------------------------------------------------------------------
Wed Mar 11 15:02:44 UTC 2015 - sweet_f_a@gmx.de
- fix build for openSUSE 13.2 ppc bnc#921955
-------------------------------------------------------------------
Tue Mar 3 05:48:08 UTC 2015 - michal.hrusecky@opensuse.org

View File

@ -1,7 +1,7 @@
#
# spec file for package mariadb
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,16 +16,23 @@
#
%define preferred 01
%define have_info 0
### WARNING!!!! ##############################################################
# This package is developed on http://github.com/openSUSE/mysql-packaging/
# Do not change anything here in OBS.
##############################################################################
%define pretty_name MariaDB
%define libname mysqlclient
%define soname 18
%define preferred 1
%define builtin_plugins partition,csv,heap,aria,pbxt,myisam,myisammrg,xtradb
%define use_extra_provides 1
%define extra_provides mariadb_100
%define srv_vers 5.6.26
%define with_mandatory_boost 0
# _tmpfilesdir is not defined in systemd macros up to openSUSE 13.2
%{!?_tmpfilesdir: %global _tmpfilesdir %{_libexecdir}/tmpfiles.d }
# Remove when 13.1 is out of support scope
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%if 0 > 0
%define with_jemalloc 1
%define with_oqgraph 1
@ -35,11 +42,10 @@
%define with_oqgraph 0
%define with_cassandra 0
%endif
Name: mariadb
Version: 10.0.17
Version: 10.0.20
Release: 0
Summary: Server part of MariaDB
Summary: Server part of %{pretty_name}
License: SUSE-GPL-2.0-with-FLOSS-exception
Group: Productivity/Databases/Servers
Url: https://www.mariadb.org
@ -51,34 +57,22 @@ Source5: mysql.SuSEfirewall2
Source7: README.install
Source8: README.SUSE
Source9: mysql-patches.tar.bz2
Source10: build.inc
Source11: install.inc
Source12: series
Source13: configuration-tweaks.tar.bz2
Source14: my.ini
Source15: rc.mysql.sysvinit
Source16: rc.mysql.systemd
Source17: mysql.service
Source15: mysql.service
Source16: mysql.target
Source17: mysql-systemd-helper
Source18: mysql@.service
BuildRequires: bison
%if 0%{with_oqgraph} > 0 || 0%{with_cassandra} > 0
BuildRequires: boost-devel
%endif
BuildRequires: cmake
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: gcc-c++
%if 0%{with_jemalloc} > 0
BuildRequires: jemalloc-devel
%endif
%if 0%{with_oqgraph} > 0
BuildRequires: judy-devel
%endif
BuildRequires: libaio-devel
BuildRequires: libbz2-devel
BuildRequires: libedit-devel
BuildRequires: libevent-devel
%if 0%{with_cassandra} > 0
BuildRequires: libthrift-devel
%endif
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: lzo-devel
@ -86,6 +80,7 @@ BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pcre-devel
BuildRequires: pkgconfig
BuildRequires: procps
BuildRequires: pwdutils
BuildRequires: readline-devel
@ -93,46 +88,65 @@ BuildRequires: sqlite
BuildRequires: tcpd-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(systemd)
# Tests requires time and ps and some perl modules
# Keep in sync with Requires of mysql-testsuite
BuildRequires: procps
BuildRequires: time
BuildRequires: perl(Env)
BuildRequires: perl(Exporter)
BuildRequires: perl(Fcntl)
BuildRequires: perl(File::Temp)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(IPC::Open3)
BuildRequires: perl(Socket)
BuildRequires: perl(Sys::Hostname)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
# required by rcmysql
Requires: %{name}-client
Requires: %{name}-errormessages = %{version}
Requires: perl-base
Requires(pre): pwdutils
Recommends: logrotate
Provides: mysql-Max = %{srv_vers}
# Compatibility with Fedora/CentOS
Provides: mysql-server = %{srv_vers}
Provides: mariadb-server = %{srv_vers}
# Compatibility with old version
Provides: %{name}-debug-version = %{srv_vers}
Obsoletes: %{name}-debug-version < %{srv_vers}
Provides: %{name}-debug = %{srv_vers}
Obsoletes: %{name}-debug < %{srv_vers}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Conflicts: otherproviders(mysql)
Conflicts: otherproviders(mysql-server)
Conflicts: otherproviders(mariadb-server)
Conflicts: otherproviders(mysql)
Conflicts: otherproviders(mysql-debug)
%{?systemd_requires}
%if 0%{have_info} > 0
Requires(post): %{install_info_prereq} %insserv_prereq
%endif
%if "%{name}" != mysql
Provides: mysql = %{srv_vers}
Provides: mysql-debug = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Conflicts: otherproviders(mysql-server)
# Compatibility with Fedora/CentOS
Provides: mysql-server = %{version}
Provides: mariadb-server = %{version}
# Compatibility with old version
Provides: %{name}-debug-version = %{version}
Obsoletes: %{name}-debug-version < %{version}
Provides: %{name}-debug = %{version}
Obsoletes: %{name}-debug < %{version}
Provides: mysql = %{version}
Provides: mysql-debug = %{version}
Provides: %{extra_provides} = %{version}
Obsoletes: %{extra_provides} < %{version}
Provides: %{extra_provides}-debug-version = %{version}
Obsoletes: %{extra_provides}-debug-version < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%if 0%{with_mandatory_boost} > 0
BuildRequires: boost-devel >= 1.57.0
%endif
%if 0%{with_oqgraph} > 0 || 0%{with_cassandra} > 0
BuildRequires: boost-devel
%endif
%if 0%{with_jemalloc} > 0
BuildRequires: jemalloc-devel
%endif
%if 0%{with_oqgraph} > 0
BuildRequires: judy-devel
%endif
%if 0%{with_cassandra} > 0
BuildRequires: libthrift-devel
%endif
%if 0%{?preferred} > 0
Obsoletes: mysql-Max < %{srv_vers}
%if "%{name}" != mysql
Obsoletes: mysql < %{srv_vers}
Obsoletes: mysql-debug < %{srv_vers}
%endif
Obsoletes: mysql < %{version}
Obsoletes: mysql-debug < %{version}
%endif
%description
@ -144,81 +158,77 @@ This package only contains the server-side programs.
%if 0%{?preferred} > 0
%package -n libmysqlclient-devel
Summary: MariaDB development header files and libraries
Summary: %{pretty_name} development header files and libraries
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libmysqlclient_r18 = %{version}
Requires: libmysqlclient18 = %{version}
Requires: libmysqlclient%{soname} = %{version}
Requires: libmysqlclient_r%{soname} = %{version}
Requires: openssl-devel
Requires: zlib-devel
# mysql-devel was last used in openSUSE 10.2
Provides: mysql-devel = %{srv_vers}-%{release}
Obsoletes: mysql-devel < %{srv_vers}
# mysql-devel needs to be provided as some pkgs still depend on it
Provides: mysql-devel = %{version}
Obsoletes: mysql-devel < %{version}
%description -n libmysqlclient-devel
This package contains the development header files and libraries
necessary to develop client applications for MariaDB.
necessary to develop client applications for %{pretty_name}.
%package -n libmysqld18
Summary: MariaDB embedded server development files
%package -n libmysqld%{soname}
Summary: %{pretty_name} embedded server development files
Group: Development/Libraries/C and C++
Requires: %{name}-errormessages = %{version}
%description -n libmysqld18
%description -n libmysqld%{soname}
This package contains the development header files and libraries
for developing applications that embed the MariaDB.
for developing applications that embed the %{pretty_name}.
%package -n libmysqld-devel
Summary: MariaDB embedded server development files
Summary: %{pretty_name} embedded server development files
Group: Development/Libraries/C and C++
# the headers files are the shared
Requires: libmysqlclient-devel = %{version}
Requires: libmysqld18 = %{version}
Requires: libmysqld%{soname} = %{version}
Requires: tcpd-devel
%description -n libmysqld-devel
This package contains the development header files and libraries
for developing applications that embed the MariaDB.
for developing applications that embed the %{pretty_name}.
%endif
%package -n libmysqlclient18
Summary: Shared Libraries for MariaDB
%package -n lib%{libname}%{soname}
Summary: Shared Libraries for %{pretty_name}
Group: Development/Libraries/Other
%description -n libmysqlclient18
%description -n lib%{libname}%{soname}
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
languages and applications need to dynamically load and use %{pretty_name}.
%package -n libmysqlclient_r18
Summary: Shared Libraries for MariaDB
%package -n lib%{libname}_r%{soname}
Summary: Shared Libraries for %{pretty_name}
Group: Development/Libraries/Other
Requires: libmysqlclient18
Requires: lib%{libname}%{soname}
%description -n libmysqlclient_r18
%description -n lib%{libname}_r%{soname}
This package contains the shared libraries (.so) which certain
languages and applications need to dynamically load and use MariaDB.
languages and applications need to dynamically load and use %{pretty_name}.
%package client
Summary: Client for MariaDB
Summary: Client for %{pretty_name}
Group: Productivity/Databases/Clients
Requires: %{name}-errormessages = %{version}
Conflicts: otherproviders(mysql-client)
%if "%{name}" != mysql
Provides: mysql-client = %{srv_vers}
%endif
# Explicit requires to pull in charsets for errormessages
Requires: lib%{libname}%{soname}
Requires(pre): pwdutils
%if 0%{?use_extra_provides} > 0
Conflicts: otherproviders(mysql-client)
Provides: mysql-client = %{version}
Provides: %{extra_provides}-client = %{version}
Obsoletes: %{extra_provides}-client < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-client < %{srv_vers}
%endif
Obsoletes: mysql-client < %{version}
%endif
%description client
This package contains the standard clients for MariaDB.
This package contains the standard clients for %{pretty_name}.
%package errormessages
Summary: MySQL Community Server development header files and libraries
@ -229,81 +239,77 @@ This package provides the translated error messages for the standalone
server daemon as well as the embedded server
%package bench
Summary: Benchmarks for MariaDB
Summary: Benchmarks for %{pretty_name}
Group: Productivity/Databases/Tools
Requires: %{name}-client
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-bench)
%if "%{name}" != mysql
Provides: mysql-bench = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: mysql-bench = %{version}
Provides: %{extra_provides}-bench = %{version}
Obsoletes: %{extra_provides}-bench < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-bench < %{srv_vers}
%endif
Obsoletes: mysql-bench < %{version}
%endif
%description bench
This package contains benchmark scripts and data for MariaDB.
This package contains benchmark scripts and data for %{pretty_name}.
To run these database benchmarks, start the script "run-all-tests" in
the directory %{_datadir}/sql-bench after starting MariaDB.
the directory %{_datadir}/sql-bench after starting %{pretty_name}.
%package test
Summary: Testsuite for MariaDB
Summary: Testsuite for %{pretty_name}
Group: Productivity/Databases/Servers
Requires: %{name} = %{version}
Requires: %{name}-bench = %{version}
Requires: %{name}-client = %{version}
Requires: %{name}-tools = %{version}
# Tests requires time and ps and some perl modules
Requires: procps
Requires: time
Requires: perl(Env)
Requires: perl(Exporter)
Requires: perl(Fcntl)
Requires: perl(File::Temp)
Requires: perl(Data::Dumper)
Requires: perl(Getopt::Long)
Requires: perl(IPC::Open3)
Requires: perl(Socket)
Requires: perl(Sys::Hostname)
Requires: perl(Test::More)
Requires: perl(Time::HiRes)
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-test)
%if "%{name}" != mysql
Provides: mysql-test = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: mysql-test = %{version}
Provides: %{extra_provides}-test = %{version}
Obsoletes: %{extra_provides}-test < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-test < %{srv_vers}
%endif
Obsoletes: mysql-test < %{version}
%endif
%description test
This package contains the test scripts and data for MariaDB.
This package contains the test scripts and data for %{pretty_name}.
To run the testsuite, run %{_datadir}/mysql-test/suse-test-run.
%package tools
Summary: MariaDB tools
Summary: %{pretty_name} tools
Group: Productivity/Databases/Servers
Requires: perl-DBD-mysql
Conflicts: otherproviders(mysql-tools)
# make sure this package is installed when updating from 10.2 and older
Provides: mysql-client:%{_bindir}/perror
Provides: mysql:%{_bindir}/mysqlhotcopy
Conflicts: otherproviders(mysql-tools)
%if "%{name}" != mysql
Provides: mysql-tools = %{srv_vers}
%endif
%if 0%{?use_extra_provides} > 0
Provides: mysql-tools = %{version}
Provides: %{extra_provides}-tools = %{version}
Obsoletes: %{extra_provides}-tools < %{version}
%endif
%if 0%{?preferred} > 0
%if "%{name}" != mysql
Obsoletes: mysql-tools < %{srv_vers}
%endif
Obsoletes: mysql-tools < %{version}
%endif
%description tools
A set of scripts for administering a MariaDB or developing
applications with MariaDB.
A set of scripts for administering a %{pretty_name} or developing
applications with %{pretty_name}.
%prep
%setup -q -n mariadb-%{version} -D -a 9
@ -327,8 +333,8 @@ rm -f sql/sql_builtin.cc
sed -i 's|@localstatedir@|%{_localstatedir}/log|' support-files/mysql-log-rotate.sh
%if 0%{preferred} < 1
for i in `grep -Rl mysqlclient .`; do
sed -i 's|mysqlclient|mysqlclient|g' $i
sed -i 's|-libmysqlclient-symbols.patch|-libmysqlclient-symbols.patch|g' $i
sed -i 's|mysqlclient|%{libname}|g' $i
sed -i 's|-lib%{libname}-symbols.patch|-libmysqlclient-symbols.patch|g' $i
done
%endif
# Broken test that needs sources
@ -339,80 +345,334 @@ for i in `grep -Rl '^#!@PERL@$' .`; do
done
%build
%{expand:%(cat %{_sourcedir}/build.inc)}
EXTRA_FLAGS="-Wno-unused-but-set-variable -fno-strict-aliasing -Wno-unused-parameter"
# Mariadb devs seems to fall in love with -Werror option
EXTRA_FLAGS="${EXTRA_FLAGS} -Wno-error"
export CFLAGS="%{optflags} -DOPENSSL_LOAD_CONF -DPIC -fPIC -DFORCE_INIT_OF_VARS $EXTRA_FLAGS"
export CXXFLAGS="$CFLAGS -felide-constructors"
%cmake -DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBEVENT=system \
-DWITH_JEMALLOC=auto \
-DWITH_READLINE=0 \
-DWITH_LIBEDIT=0 \
-DINSTALL_LAYOUT=RPM \
-DMYSQL_UNIX_ADDR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_UNIX_ADDRDIR="%{_localstatedir}/run/mysql/mysql.sock" \
-DINSTALL_MYSQLSHAREDIR=share/%{name} \
-DWITH_COMMENT="openSUSE MySQL rpm" \
-DWITH_EXTRA_CHARSET=all \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
%if 0%{with_oqgraph} > 0
-DWITH_OQGRAPH_STORAGE_ENGINE=1 \
%endif
%if 0%{with_cassandra} > 0
-DWITH_CASSANDRA_STORAGE_ENGINE=1 \
%endif
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_CSV_STORAGE_ENGINE=1 \
-DWITH_HANDLERSOCKET_STORAGE_ENGINE=1 \
-DWITH_EMBEDDED_SERVER=true \
-DCOMPILATION_COMMENT="openSUSE package" \
-DDENABLE_DOWNLOADS=false \
-DINSTALL_PLUGINDIR_RPM="%{_lib}/mysql/plugin" \
-DINSTALL_LIBDIR_RPM="%{_lib}" \
-DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$CFLAGS" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_SQLBENCHDIR=share \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
-Wno-dev "$@" ..
make %{?_smp_mflags}
nm --numeric-sort sql/mysqld > sql/mysqld.sym
%install
%{expand:%(cat %{_sourcedir}/install.inc)}
# Helper function to generate filelist for binaries and their manpages
filelist()
{
echo '%%defattr(-, root, root)'
pushd %{buildroot} >/dev/null
for i; do
if test -e usr/sbin/"$i"; then
echo %{_sbindir}/"$i"
fi
if test -e usr/bin/"$i"; then
echo %{_bindir}/"$i"
fi
if test -d usr/share/*/"$i"; then
echo "/`echo usr/share/*/"$i"`"
fi
if test -n "`ls -1 %{buildroot}$i 2> /dev/null`"; then
echo "$i"
fi
if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then
echo "%{_mandir}/*/$i.[1-9]*"
fi
done
popd >/dev/null
}
%pre
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
%service_add_pre mysql.service
# Install the package itself
%cmake_install benchdir_root=%{_datadir}/
%pre client
%{_sbindir}/groupadd -r mysql >/dev/null 2>/dev/null || :
%{_sbindir}/useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql 2> /dev/null || :
%{_sbindir}/usermod -g mysql -s /bin/false mysql 2> /dev/null || :
# Logrotate file should be named as the package
if [ ! -e %{buildroot}%{_sysconfdir}/logrotate.d/mysql ]; then
# some versions do not install it automatically
install -D -m 644 build/support-files/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysql
fi
mv %{buildroot}%{_sysconfdir}/logrotate.d/mysql %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%post
%service_add_post mysql.service
# Create log directory with the expected perms of mysql
install -d -m 700 %{buildroot}%{_localstatedir}/log/mysql/
#######################################################################
# preun and posttran takes care of restart #
#######################################################################
# Symbols from build to go into libdir
install -m 644 build/sql/mysqld.sym %{buildroot}%{_libdir}/mysql/mysqld.sym
%preun
[ $1 = 1 ] || %{_sbindir}/rcmysql stop || true
# Remove handler socket client
rm -f %{buildroot}%{_libdir}/mysql/plugin/handlersocket.so
%posttrans
%if 0%{have_info} > 0
[ -z "`ls %{_infodir}/mysql.info.* 2> /dev/null`" ] || \
%install_info --info-dir=%{_infodir} %{_infodir}/mysql.info.*
%endif
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
for in in protected tmp; do
rmdir %{_localstatedir}/lib/mysql/.$i 2>/dev/null || :
# Remove debug management for keys Mariadb 101+
rm -f %{buildroot}%{_libdir}/mysql/plugin/debug_key_management.so
# Remove most static libs (FIXME: don't build them at all...)
[ \! -f "%{buildroot}%{_libdir}/"libmysqld.a ] || mv "%{buildroot}%{_libdir}/"libmysqld.a "%{buildroot}%{_libdir}/"libmysqld.static
rm -f %{buildroot}%{_libdir}/*.a
[ \! -f "%{buildroot}%{_libdir}/"libmysqld.static ] || mv "%{buildroot}%{_libdir}/"libmysqld.static "%{buildroot}%{_libdir}/"libmysqld.a
# Rename mytop to have name prefixed with the implementation
[ \! -f "%{buildroot}%{_bindir}/mytop" ] || mv %{buildroot}%{_bindir}/mytop %{buildroot}%{_bindir}/%{name}_mytop
# Remove few configure/examples
rm -f %{buildroot}%{_datadir}/mysql/{binary-configure,errmsg-utf8.txt,magic,mysql-log-rotate,mysql*.server}
rm -f %{buildroot}%{_libdir}/mysql/plugin/daemon_example.ini
mv %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir}
# Generate various filelists
filelist innochecksum my_print_defaults myisam_ftdump myisamchk myisamlog myisampack mysql_fix_extensions mysql_fix_privilege_tables mysql_ssl_rsa_setup mysql_install_db mysql_secure_installation mysql_upgrade mysqlbug mysqld mysqld_multi mysqld_safe mysqlbinlog mysqldumpslow mysqlmanager mroonga resolve_stack_dump resolveip {m,}aria_chk {m,}aria_dump_log {m,}aria_ftdump {m,}aria_pack {m,}aria_read_log xtstat tokuft_logprint tokuftdump >mysql.files
filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow mysql_config_editor >mysql-client.files
# The dialog stuff is mariadb only
if [ "`ls '%buildroot'%_libdir/mysql/plugin/dialog*.so 2> /dev/null`" ]; then
echo '%%dir %%_libdir/mysql' >> mysql-client.files
echo '%%dir %%_libdir/mysql/plugin' >> mysql-client.files
echo '%%_libdir/mysql/plugin/dialog*.so' >> mysql-client.files
fi
# Mysql has configuration file in _bindir
if [ -f scripts/mysqlaccess.conf ] ; then
install -m 640 scripts/mysqlaccess.conf %{buildroot}%{_sysconfdir}/mysqlaccess.conf
rm -f %{buildroot}%{_bindir}/mysqlaccess.conf
echo '%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/mysqlaccess.conf' >> mysql-client.files
fi
filelist mysql_config %{_datadir}/pkgconfig/mariadb.pc >libmysqlclient-devel.files
filelist mysqlslap >mysql-bench.files
filelist mysql_client_test mysql_client_test_embedded mysql_waitpid mysqltest mysqltest_embedded >mysql-test.files
filelist msql2mysql mysql_plugin mysql_convert_table_format mysql_find_rows mysql_setpermission mysql_tzinfo_to_sql mysql_zap mysqlaccess mysqlhotcopy perror replace mysql_embedded %{name}_mytop hsclient %{_bindir}/wsrep* %{_datadir}/mysql/wsrep_notify >mysql-tools.files
filelist ndbd ndbmtd ndbd_redo_log_reader >mysql-ndb-storage.files
filelist ndb_mgmd >mysql-ndb-management.files
filelist ndb_{config,desc,error_reporter,mgm,print_backup_file,print_schema_file,print_sys_file,restore,select_all,select_count,show_tables,size.pl,test_platform,waiter} >mysql-ndb-tools.files
filelist ndb_{cpcd,delete_all,drop_index,index_stat,print_file,redo_log_reader,drop_table} ndbinfo_select_all memcached >mysql-ndb-extra.files
# All configuration files
echo '%{_datadir}/mysql/*.cnf' >> mysql.files
# Mysql-community server has dictionary file in datadir
if [ -f "%{buildroot}%{_datadir}/%{name}"/dictionary.txt ]; then
echo "%{_datadir}/%{name}/dictionary.txt" >> mysql.files
fi
# Special errormessages approach
echo '%%defattr(-, root, root)' > %{_builddir}/errormessages.files
pushd %{buildroot} >/dev/null
for f in usr/share/%{name}/*; do
if test -e $f/errmsg.sys; then
echo "%%dir /$f" >> %{_builddir}/errormessages.files
fi
done
# During package rename, there might be config file move
if [ -f /etc/my.cnf.rpmsave ]; then
mv /etc/my.cnf{,.rpmnew}
mv /etc/my.cnf{.rpmsave,}
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
echo %{_datadir}/%{name}/errmsg-utf8.txt >> %{_builddir}/errormessages.files
popd >/dev/null
mv %{_builddir}/errormessages.files errormessages.files
WARNING: /etc/my.cnf.rpmsave file detected!
### files not installed by make install
# Some of the documentation we need to have installed
DOCS=(COPYING README EXCEPTIONS-CLIENT %{_sourcedir}/README.debug %{_sourcedir}/README.SUSE plugin/daemon_example/daemon_example.ini)
DOCDIR=%{buildroot}%{_defaultdocdir}/%{name}
install -d -m 755 ${DOCDIR}
for i in "${DOCS[@]}"; do
install -m 644 "${i}" "${DOCDIR}" || true
done
# Default configuration file
install -m 660 %{SOURCE14} %{buildroot}%{_sysconfdir}/my.cnf
This probably means that you are upgrading from different variant of MySQL.
Your original configuration file was restored. If it is not a case, you can
find your original /etc/my.cnf as /etc/my.cnf.rpmnew
# Systemd/initscript
install -D -m 755 %{_sourcedir}/mysql-systemd-helper '%{buildroot}'%{_libexecdir}/mysql/mysql-systemd-helper
sed -i 's|@MYSQLVER@|%{version}|' '%{buildroot}'%{_libexecdir}/mysql/mysql-systemd-helper
ln -sf service '%{buildroot}'%{_sbindir}/rcmysql
install -D -m 644 %{_sourcedir}/mysql.service '%{buildroot}'%{_libexecdir}/systemd/system/mysql.service
install -D -m 644 %{_sourcedir}/mysql@.service '%{buildroot}'%{_libexecdir}/systemd/system/mysql@.service
install -D -m 644 %{_sourcedir}/mysql.target '%{buildroot}'%{_libexecdir}/systemd/system/mysql.target
ln -s mysql@.service '%{buildroot}'%{_libexecdir}/systemd/system/mysql@default.service
rm -rf '%{buildroot}'%{_sysconfdir}/init.d
# Tmpfiles file to exclude mysql tempfiles that are auto-cleaned up
# bnc#852451
mkdir -p %{buildroot}%{_tmpfilesdir}
cat > %{buildroot}%{_tmpfilesdir}/mysql.conf <<EOF
x /var/tmp/mysql.*
X /var/tmp/mysql.*
EOF
# SuSEfirewall service description
install -D -m 644 %{_sourcedir}/mysql.SuSEfirewall2 %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
# testsuite
install -d -m 755 '%{buildroot}'%{_datadir}/mysql-test/
install -m 755 suse-test-run '%{buildroot}'%{_datadir}/mysql-test/
mkdir '%{buildroot}'%{_datadir}/mysql-test/var
# Final fixes
find '%{buildroot}'%{_datadir}/mysql-test -name '*.orig' -delete
%fdupes -s '%{buildroot}'%{_datadir}/mysql-test
fdupes -q -n -r '%{buildroot}'%{_datadir}/mysql-test
for i in `grep -Rl '\r' '%{buildroot}'%{_datadir}/sql-bench`; do
dos2unix "$i"
done
# Fix libmysqlclient_r.so.18 symlinking to be done against plain .so file
# and thus broken later on. Fixes bnc#906147
pushd "%{buildroot}%{_libdir}"
rm -f lib%{libname}_r.so*
ln -sf lib%{libname}.so.%{soname}.0.0 lib%{libname}_r.so
ln -sf lib%{libname}.so.%{soname}.0.0 lib%{libname}_r.so.%{soname}
ln -sf lib%{libname}.so.%{soname}.0.0 lib%{libname}_r.so.%{soname}.0.0
popd
# If not preffered simply reduce main develpackage to NULL
%if ! 0%{preferred} > 0
cat libmysqlclient-devel.files | sed 's|%%doc\ ||' | while read tmp; do
cd '%{buildroot}'
rm -f ."$tmp"
done
rm -rf '%{buildroot}'/%{_libdir}/libmysqld.*
rm -rf '%{buildroot}'/%{_libdir}/{*.so,*.a}
rm -rf '%{buildroot}'/%{_mandir}/*/mysql_config.1*
rm -rf '%{buildroot}'/%{_includedir}
rm -rf '%{buildroot}'/%{_datadir}/aclocal
%endif
# Compat with old scripts
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqlrepair
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqlanalyze
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqloptimize
# Use our configuration stuff instead of upstream one
rm -rf '%{buildroot}'%{_sysconfdir}/my.cnf.d
install -d -m 755 '%{buildroot}'%{_sysconfdir}/my.cnf.d
bzip2 -cd '%{_sourcedir}'/configuration-tweaks.tar.bz2 | tar -C '%{buildroot}'%{_sysconfdir}/my.cnf.d -xvf -
# Documentation that was copied to wrong folder
rm -f '%{buildroot}'%{_datadir}/doc/* 2> /dev/null || true
# Unwanted packaged stuff
rm -rf '%{buildroot}'%{_datadir}/mysql/{solaris,SELinux}
%check
cd build
# First run simple ctest unittests
LD_LIBRARY_PATH=$(pwd)/unittest/mytap make test %{?_smp_mflags}
# And then run discustingly HUGE testsuite that might fail here and there
# Basically we run it to have overview to check how it goes
cd mysql-test
./mysql-test-run.pl \
--parallel=%{?jobs:%{jobs}} \
--force \
--retry=0 \
--ssl \
--suite-timeout=720 \
--testcase-timeout=30 \
--mysqld=--binlog-format=mixed \
--force-restart \
--shutdown-timeout=60 \
--max-test-fail=0 || :
# client does not require server and needs the user too
%pre client
getent group mysql >/dev/null || groupadd -r mysql
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
usermod -g mysql -s /bin/false mysql
exit 0
%pre
getent group mysql >/dev/null || groupadd -r mysql
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
usermod -g mysql -s /bin/false mysql
%service_add_pre mysql.service mysql@.service mysql.target mysql@default.service
%post
%service_add_post mysql.service mysql@.service mysql.target mysql@default.service
# Use %tmpfiles_create when 13.2 is oldest in support scope
/usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/mysql.conf || :
# SLE11 Migration support
for i in protected tmp; do
rmdir "$datadir"/.$i 2>/dev/null || :
done
# Remove any messages that could've been in place about the upgrade
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
# During package rename (migration maria->mysql-community-server),
# there might be config file move and we get rpmsave that we should keep
if [ -f %{_sysconfdir}/my.cnf.rpmsave ]; then
mv %{_sysconfdir}/my.cnf{,.rpmnew}
mv %{_sysconfdir}/my.cnf{.rpmsave,}
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: %{_sysconfdir}/my.cnf.rpmsave file detected!
This probably means that you are migrating from different variant of MySQL.
Your configuration was left intact and you can see the new configuration in
%{_sysconfdir}/my.cnf.rpmnew
EOF
fi
# warn on first run
if [ -x %{_bindir}/my_print_defaults ]; then
datadir="`%{_bindir}/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
fi
datadir="`%{_bindir}/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
[ -n "$datadir" ] || datadir="%{_localstatedir}/lib/mysql"
if [ -d "$datadir/mysql" ]; then
touch "$datadir/.run-mysql_upgrade"
touch "$datadir/.run-mysql_upgrade"
fi
for in in protected tmp; do
rmdir "$datadir"/.$i 2>/dev/null || :
done
if [ \! -f "$datadir/mysql_upgrade_info" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
if [ $1 -eq 1 ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
%(cat %{_sourcedir}/README.install)
EOF
fi
else
MYSQLVER="`echo %{version} | sed 's|\.[0-9]\+$||'`"
if [ -f "$datadir/mysql_upgrade_info" ] && \
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
MYSQLVER="`echo %{version} | sed 's|\.[0-9]\+$||'`"
if [ -f "$datadir/mysql_upgrade_info" ] && \
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
WARNING: You are upgrading from different stable version of MySQL!
@ -421,62 +681,45 @@ Before you do that make sure you have up to date backup of your data. It
should be mainly in $datadir directory.
EOF
fi
fi
fi
# start mysql again if it should run - migration from old setup
if [ -d %{_rundir}/mysql/restart ]; then
[ -x %{_sbindir}/rcmysql ] && %{_sbindir}/rcmysql start
# Might not be there, so ignoring errors
rmdir %{_rundir}/mysql/restart 2> /dev/null
fi
exit 0
#######################################################################
# Various ldconfig post scripts #
#######################################################################
%post -n libmysqlclient18 -p /sbin/ldconfig
%postun -n libmysqlclient18 -p /sbin/ldconfig
%post -n libmysqlclient_r18 -p /sbin/ldconfig
%postun -n libmysqlclient_r18 -p /sbin/ldconfig
%if 0%{preferred} > 0
%post -n libmysqld18 -p /sbin/ldconfig
%postun -n libmysqld18 -p /sbin/ldconfig
%endif
%preun
%service_del_preun mysql.service mysql@.service mysql.target mysql@default.service
%postun
if [ $1 = 0 ]; then
%if 0%{have_info} > 0
%install_info_delete --info-dir=%{_infodir} %{_infodir}/mysql.info.*
%endif
%insserv_cleanup
rm -f "%{_localstatedir}/lib/systemd/migrated/mysql.service"
if [ -x %{_bindir}/systemctl ]; then
%{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || :
fi
fi
%service_del_postun mysql.service mysql@.service mysql.target mysql@default.service
#######################################################################
# Files section #
#######################################################################
%post -n lib%{libname}%{soname} -p /sbin/ldconfig
%postun -n lib%{libname}%{soname} -p /sbin/ldconfig
%post -n lib%{libname}_r%{soname} -p /sbin/ldconfig
%postun -n lib%{libname}_r%{soname} -p /sbin/ldconfig
%if 0%{preferred} > 0
%post -n libmysqld%{soname} -p /sbin/ldconfig
%postun -n libmysqld%{soname} -p /sbin/ldconfig
%endif
%files -f mysql.files
%defattr(-, root, root)
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf
%dir %attr(0750, root, mysql) %{_sysconfdir}/my.cnf.d
%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/my.cnf.d/*
%config %{_sysconfdir}/logrotate.d/mysql
%config %{_sysconfdir}/logrotate.d/%{name}
%doc %{_defaultdocdir}/%{name}
%if 0%{have_info} > 0
%doc %{_infodir}/mysql.info.*
%endif
%dir %{_libexecdir}/mysql
%{_libexecdir}/mysql/rcmysql
%dir %attr(0700, mysql, mysql) %{_localstatedir}/log/mysql
%{_libexecdir}/mysql/mysql-systemd-helper
%{_libexecdir}/systemd/system/mysql.service
%{_libexecdir}/systemd/system/mysql@.service
%{_libexecdir}/systemd/system/mysql@default.service
%{_libexecdir}/systemd/system/mysql.target
%{_tmpfilesdir}/mysql.conf
%{_sbindir}/rcmysql
%dir %{_datadir}/%{name}
%dir %{_datadir}/mysql
@ -487,6 +730,7 @@ fi
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
%dir %{_libdir}/mysql/plugin
%{_libdir}/mysql/plugin/[!d]*.so
%ghost %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
%files errormessages -f errormessages.files
%defattr(-, root, root)
@ -500,7 +744,6 @@ fi
%defattr(-, root, root)
%{_includedir}/mysql
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/mysql.m4
@ -509,18 +752,20 @@ fi
%{_libdir}/libmysqld.a
%{_libdir}/libmysqld.so
%files -n libmysqld18
%files -n libmysqld%{soname}
%defattr(-,root,root)
%{_libdir}/libmysqld.so.*
%endif
%files -n libmysqlclient18
%files -n lib%{libname}%{soname}
%defattr(-, root, root)
%{_libdir}/libmysqlclient.so.*
%{_libdir}/lib%{libname}.so.*
%files -n libmysqlclient_r18
%files -n lib%{libname}_r%{soname}
%defattr(-, root, root)
%{_libdir}/libmysqlclient_r.so.*
# We need .so file here as few apps still rely on it to be present.
# Currently known are Mysql workbench and Libreoffice
%{_libdir}/lib%{libname}_r.so*
%files bench -f mysql-bench.files
%defattr(-, root, root)

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d0850543056d459a235ccb6e4d36f503e7dfe58a2ce2ef6015072d495000c533
size 14898
oid sha256:4a402573f978d63eef12baaa5e15af4a13a913b95b18fd70f75b6600ba416c1f
size 16529

175
mysql-systemd-helper Normal file
View File

@ -0,0 +1,175 @@
#!/bin/bash
die() {
echo "$1"
exit 1
}
# Read options from config file
read_config() {
# Initial settings
MYSQLVER="$(echo @MYSQLVER@ | sed 's|\.[0-9]\+$||')"
mysql_daemon_user=mysql
mysql_daemon_group=mysql
if [[ -z "$INSTANCE" || "x$INSTANCE" = "xdefault" ]]; then
datadir=/var/lib/mysql
socket="/var/run/mysql/mysql.sock"
else
datadir="/var/lib/mysql-$INSTANCE"
socket="/var/run/mysql/mysql.${INSTANCE}.sock"
fi
# Read options - important for multi setup
if [[ -n "$INSTANCE" && "x$INSTANCE" != "xdefault" ]]; then
opts="$(/usr/bin/my_print_defaults --mysqld mysqld_multi "$INSTANCE")"
tmp_opts="$opts"
else
opts="$(/usr/bin/my_print_defaults --mysqld)"
tmp_opts="$opts"
fi
# Update local variables according to the settings from config
for arg in $tmp_opts; do
case "$arg" in
--basedir=*) basedir="$(echo "$arg" | sed -e 's/^[^=]*=//')" ;;
--socket=*) socket="$(echo "$arg" | sed -e 's/^[^=]*=//')" ;;
--datadir=*) datadir="$(echo "$arg" | sed -e 's/^[^=]*=//')" ;;
--user=*) mysql_daemon_user="$(echo "$arg" | sed -e 's/^[^=]*=//')" ;;
--group=*) mysql_daemon_group="$(echo "$arg" | sed -e 's/^[^=]*=//')" ;;
esac
done
}
# Create new empty database if needed
mysql_install() {
if [[ ! -d "$datadir/mysql" ]]; then
echo "Creating MySQL privilege database... "
mysql_install_db --user="$mysql_daemon_user" --datadir="$datadir" || \
die "Creation of MySQL databse in $datadir failed"
echo -n "$MYSQLVER" > "$datadir"/mysql_upgrade_info
fi
}
# Upgrade database if needed
mysql_upgrade() {
# Run mysql_upgrade on every package install/upgrade. Not always
# necessary, but doesn't do any harm.
if [[ -f "$datadir/.run-mysql_upgrade" ]]; then
echo "Checking MySQL configuration for obsolete options..."
sed -i -e 's|^\([[:blank:]]*\)skip-locking|\1skip-external-locking|' \
-e 's|^\([[:blank:]]*skip-federated\)|#\1|' /etc/my.cnf
# instead of running mysqld --bootstrap, which wouldn't allow
# us to run mysql_upgrade, we start a full-featured server with
# --skip-grant-tables and restict access to it by unix
# permissions of the named socket
echo "Trying to run upgrade of MySQL databases..."
# Check whether upgrade process is not already running
protected="$(cat "/var/run/mysql/protecteddir.$INSTANCE" 2> /dev/null)"
if [[ -n "$protected" && -d "$protected" ]]; then
pid="$(cat "$protected/mysqld.pid" 2> /dev/null)"
if [[ "$pid" && -d "/proc/$pid" ]] &&
[[ $(readlink "/proc/$pid/exe" | grep -q "mysql") ]]; then
die "Another upgrade in already in progress!"
else
echo "Stale files from previous upgrade detected, cleaned them up"
rm -rf "$protected"
rm -f "/var/run/mysql/protecteddir.$INSTANCE"
fi
fi
protected="$(mktemp -d -p /var/tmp mysql-protected.XXXXXX | tee "/var/run/mysql/protecteddir.$INSTANCE")"
[ -n "$protected" ] || die "Can't create a tmp dir '$protected'"
# Create a secure tmp dir
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$protected" || die "Failed to set group/user to '$protected'"
chmod 0700 "$protected" || die "Failed to set permissions to '$protected'"
# Run protected MySQL accessible only though socket in our directory
echo "Running protected MySQL... "
/usr/sbin/mysqld \
--user="$mysql_daemon_user" --group="$mysql_daemon_group" \
$opts \
--skip-networking \
--skip-grant-tables \
--log-error="$protected/log_upgrade_run" \
--socket="$protected/mysql.sock" \
--pid-file="$protected/mysqld.pid" &
mysql_wait "$protected/mysql.sock" || die "MySQL didn't start, can't continue"
# Run upgrade itself
echo "Running upgrade itself..."
echo "It will do some chek first and report all errors and tries to correct them"
echo
if /usr/bin/mysql_upgrade --no-defaults --force --socket="$protected/mysql.sock"; then
echo "Everything upgraded successfully"
up_ok=""
rm -f "$datadir/.run-mysql_upgrade"
[[ $(grep -q "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null) ]] || \
echo -n "$MYSQLVER" > "$datadir/mysql_upgrade_info"
else
echo "Upgrade failed"
up_ok="false"
fi
# Shut down MySQL
echo "Shuting down protected MySQL"
kill "$(cat "$protected/mysqld.pid")"
for i in {1..30}; do
/usr/bin/mysqladmin --socket="$protected/mysql.sock" ping > /dev/null 2>&1 || break
done
/usr/bin/mysqladmin --socket="$protected/mysql.sock" ping > /dev/null 2>&1 && kill -9 "$(cat "$protected/mysqld.pid")"
# Cleanup
echo "Final cleanup"
rm -rf "$protected" "/var/run/mysql/protecteddir.$INSTANCE"
[[ -z "$up_ok" ]] || die "Something failed during upgrade, please check logs"
fi
}
mysql_wait() {
[[ -z "$1" ]] || socket="$1"
echo "Waiting for MySQL to start"
for i in {1..60}; do
/usr/bin/mysqladmin --socket="$socket" ping > /dev/null 2>&1 && break
sleep 1
done
if /usr/bin/mysqladmin --socket="$socket" ping > /dev/null 2>&1; then
echo "MySQL is alive"
return 0
else
echo "MySQL is still dead"
return 1
fi
}
mysql_start() {
/usr/sbin/mysqld --user="$mysql_daemon_user" --group="$mysql_daemon_group" $opts
}
# We rely on output in english at some points
LC_ALL=C
INSTANCE="$2"
read_config
mkdir -p /var/run/mysql
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" /var/run/mysql
case "$1" in
install)
mysql_install ;;
upgrade)
mysql_upgrade ;;
start)
mysql_start ;;
wait)
mysql_wait ;;
*)
echo "Supported commands are:"
echo " install - creates empty database if needed"
echo " upgrade - tries to migrate data to newer version if needed"
echo " start - tries to start instance"
echo " wait - waits till instance is pingable"
echo "All commands can take extra argument which is group from 'mysqld_multi' you want to work with"
;;
esac

View File

@ -1,12 +1,16 @@
[Unit]
Description=MySQL server
Wants=basic.target
After=basic.target network.target
Conflicts=mysql.target mysql@default.service
After=basic.target network.target syslog.target
[Service]
Type=forking
ExecStart=/usr/lib/mysql/rcmysql start
ExecStop=/usr/lib/mysql/rcmysql stop
Restart=on-failure
Type=simple
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install default
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade default
ExecStart=/usr/lib/mysql/mysql-systemd-helper start default
ExecStartPost=/usr/lib/mysql/mysql-systemd-helper wait default
[Install]
WantedBy=multi-user.target

2
mysql.target Normal file
View File

@ -0,0 +1,2 @@
[Unit]
Description=MySQL target allowing to control multi setup

16
mysql@.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=MySQL server - %I instance
Wants=basic.target
PartOf=mysql.target
After=basic.target network.target syslog.target
[Service]
Restart=on-failure
Type=simple
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install %i
ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade %i
ExecStart=/usr/lib/mysql/mysql-systemd-helper start %i
ExecStartPost=/usr/lib/mysql/mysql-systemd-helper wait %i
[Install]
WantedBy=multi-user.target

View File

@ -1,668 +0,0 @@
#!/bin/bash
# Copyright (c) 1995-2014 SuSE Linux AG Nuernberg, Germany.
#
# Author: Lenz Grimmer
# Maintainer: Michal Hrusecky <mhrusecky@suse.cz>
#
# mysqld_multi extension added by Richard Bos, 2008
#
# /etc/init.d/mysql
#
# and its symbolic link
#
# /usr/sbin/rcmysql
#
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop:
# Short-Description: Start the MySQL database server
# Description: Start the MySQL database server
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
_rc_status_ret=0
_rc_status=$_rc_status_ret
_rc_status_all=$_rc_status
rc_check ()
{
_rc_status_ret=$?
test "$_rc_status_ret" || _rc_status_ret=0
test 0$_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret
test 0$_rc_status -eq 0 || _rc_status_all=$_rc_status
return 0$_rc_status_ret
}
rc_status ()
{
rc_check
_rc_status_ret=$_rc_status
if [ "$1" ]; then
case "$1" in
-v|-v[1-9]|-v[1-9][0-9])
case "$_rc_status" in
0) echo "Everything is Ok" ;; # success
*) echo "Something went wrong" ;; # failed
esac
# reset _rc_status to 0 after verbose case
_rc_status=0 ;;
-r) rc_reset ;;
*) echo "rc_status: Usage: [-v[<num>] [-r]]" 1>&2 ; return 0 ;;
esac
fi
return $_rc_status_ret
}
rc_failed ()
{
rc_reset
case "$1" in
[0-7]) _rc_status=$1 ;;
"") _rc_status=1
esac
rc_check
return $_rc_status
}
rc_exit ()
{
exit $_rc_status_all
}
rc_reset ()
{
_rc_status=0
_rc_status_all=0
rc_check
return 0
}
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
# Check for the location of initscript
if [ "`echo "$0" | grep "^\."`" ] || [ "`echo "$0" | grep "^[^/].*/"`" ]; then
MYSELF="`pwd`/$0"
else
MYSELF="$0"
fi
parse_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--datadir=*) datadir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--pid-file=*) pid_file="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--socket=*) socket="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--log-error=*) log_error="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--user=*) mysql_daemon_user="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--group=*) mysql_daemon_group="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
esac
done
}
wait_for_socket()
{
local i
for((i=0; i<150; i++)); do
sleep 0.2
test -S $1 && i='' && break
done
test -z "$i" || return 1
return 0
}
# Don't run killproc -TERM, as it could send a SIGKILL as well, possibly
# resulting in database corruption. Run kill -TERM manually instead, wait
# approximately 300 seconds and fail if mysql doesn't respond. This will at
# least prevent the SIGKILL when doing 'rcmysql stop' manually. During system
# shutdown, we are out of luck...
# See https://bugzilla.novell.com/show_bug.cgi?id=223209
kill_mysql ()
{
local pid exe test_pid_file
if [ "$1" ]; then
test_pid_file="$1"
else
test_pid_file="$pid_file"
fi
test -e "$test_pid_file" || return 7 # not running
pid=`cat "$test_pid_file"` || return 4 # insufficient privileges
if ! test -e /proc/version; then
mount -n -t proc proc /proc
test -e /proc/version || return 100
fi
test -L "/proc/$pid/exe" || return 7
exe=`readlink "/proc/$pid/exe"` || return 4
test "`echo "$exe" | grep "^$MYSQLD"`" || return 7
kill -STOP "$pid"
kill -TERM "$pid" || return 4 # suboptimal
kill -CONT "$pid"
for i in `seq 3000`; do
# mysqld removes its pid file
test -e "$test_pid_file" || return 0
LC_ALL=C sleep 0.1
done
test -e "$test_pid_file" || return 0
return 1
}
# Helper function which can end with any status
set_return_value() {
return $1
}
# Checks for obsolete database
check_obsolete() {
# check for ISAM tables
tables="`find "$datadir" -name '*.ISM' 2> /dev/null | sed "s@$datadir/*@@; s@.ISM@@; s@/@.@;"`"
if test "$tables" ; then
echo
echo "Some tables still use ISAM format, which is NO LONGER SUPPORTED"
echo "since mysql 5.0. To use these tables, you would need to open them"
echo "from an older mysql server and convert to something better (eg. MyISAM)."
echo
echo "Tables using ISAM are: "
echo " $tables "
echo
fi
# check for bdb tables
tables="`find "$datadir" -name '*.db' 2> /dev/null | sed "s@$datadir/*@@; s@.db@@; s@/@.@;"`"
if test -n "$tables" ; then
echo
echo "Some tables still use BerkeleyDB format, which is NO LONGER SUPPORTED"
echo "since mysql 5.1. To use these tables, you would need to open them"
echo "from an older mysql server and convert to something better (eg. MyISAM)."
echo
echo "Tables using BerkeleyDB are: "
echo " $tables "
echo
fi
}
# Check if we want to run multiple instances.
[[ "`cat /etc/my.cnf | sed -n 's|^[[:blank:]]*\[mysqld[0-9]\+\]|yes|p'`" ]] && MYSQLD_MULTI=yes
# This was old way how to specify this, left for backward compatibility.
[[ -f /etc/sysconfig/mysql ]] && . /etc/sysconfig/mysql
if [[ "$MYSQLD_MULTI" == "yes" ]]; then
[[ -x /usr/bin/mysqld_multi ]] || {
echo -n "MySQL: /usr/bin/mysqld_multi not found"
rc_failed 5; rc_status -v; rc_exit;
}
case "$1" in
start)
# FIXME:
# We assume a fresh install if the directory $datadir/mysql
# does not exist and create the privilege database
# if ! test -d $datadir/mysql; then
# echo -n "Creating MySQL privilege database... "
# mysql_install_db --user=$mysql_daemon_user --datadir=$datadir || {
# rc_failed; rc_status -v; rc_exit
# }
# fi
echo -n "Starting service multi MySQL "
mysqld_multi start
for((i=0; i<150; i++)); do
sleep 0.2
[ "`mysqld_multi report | grep 'is not running'`" ] || break
done
if [ "`mysqld_multi report | grep 'is not running'`" ]; then
echo "Failed to start all instances"
mysqld_multi report
rc_failed; rc_status -v; rc_exit
fi
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down service multi MySQL "
mysqld_multi stop
for((i=0; i<150; i++)); do
sleep 0.2
[ "`mysqld_multi report | grep 'is running'`" ] || break
done
if [ "`mysqld_multi report | grep 'is running'`" ]; then
echo "Failed to stop all instances"
mysqld_multi report
rc_failed; rc_status -v; rc_exit
fi
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
"$MYSELF" status >/dev/null && "$MYSELF" restart
# Remember status and be quiet
rc_status
;;
restart|force-reload)
echo "Restarting service multi MySQL "
"$MYSELF" stop
"$MYSELF" start
rc_status
;;
reload)
echo -n "Reloading service multi MySQL "
mysqld_multi reload
rc_status -v
;;
status)
STATUS=$(mysqld_multi report)
echo -n "$STATUS"
# Set the status for rc_status
echo "$STATUS" | grep -q "is running"
rc_status -v
;;
*)
echo "Usage: $MYSELF {start|stop|status|reload|restart|try-restart|force-reload}"
exit 1
;;
esac
else
# Test, if mysqld or mysql-max actually exist
unset MYSQLD
# use mysqld-debug only if explicitly requested (TODO: sysconfig variable?)
if test "$MYSQLD_DEBUG" = yes -a -x /usr/sbin/mysqld
then
MYSQLD=/usr/sbin/mysqld
elif test -x /usr/sbin/mysqld-max
then
MYSQLD=/usr/sbin/mysqld-max
elif test -x /usr/sbin/mysqld
then
MYSQLD=/usr/sbin/mysqld
fi
test "$MYSQLD" || {
echo -n "Nor /usr/sbin/mysqld nor /usr/sbin/mysqld-max exists";
rc_failed 5; rc_status -v; rc_exit;
}
# The following section has been taken from
# the original MySQL init script
# Note: If you want to change these variables, you'll make your life easier
# if you do so in /etc/my.cnf, which is preserved during upgrades
basedir=/usr
datadir=/var/lib/mysql
mysql_daemon_user=mysql
mysql_daemon_group=mysql
pid_file=/var/run/mysql/mysqld.pid
socket=/var/run/mysql/mysql.sock
print_defaults=/usr/bin/my_print_defaults
log_error=/var/log/mysql/mysqld.log
mode=$1 # start or stop
log_base="`echo "$log_error" | sed 's|\.log$||'`"
[ "$log_base" \!= "$log_error" ] || log_base="/var/log/mysql/mysql"
log_upgrade="${log_base}-upgrade.log"
log_upgrade_run="${log_base}-upgrade-run.log"
log_query="${log_base}-query.log"
parse_arguments `$print_defaults $defaults mysqld mysql_server`
mkdir -m 755 -p /var/run/mysql
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" /var/run/mysql
export TEMPDIR="`cat /var/run/mysql/tmpdir 2> /dev/null`"
# Safeguard (relative paths, core dumps..)
cd "$basedir"
case "$1" in
start)
# exit gracefully, if we are already running
"$MYSELF" status >/dev/null && echo -n "Starting service MySQL " && \
rc_status -v && rc_exit
# prepare tmp dir
unset TMPDIR
if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then
rm -rf "$TEMPDIR"
fi
TEMPDIR="`mktemp -d -p /var/tmp mysql.XXXXXX | tee /var/run/mysql/tmpdir`"
[ -z "$TEMPDIR" ] || chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$TEMPDIR"
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || {
echo "Can't create secure $TEMPDIR"
rc_failed; rc_status -v; rc_exit;
}
# Test, if safe_mysqld actually exists
SAFE_MYSQLD=/usr/bin/mysqld_safe
test -x $SAFE_MYSQLD || {
echo "$SAFE_MYSQLD does not exist ";
rc_failed 5; rc_status -v; rc_exit;
}
debug_flags=""
if test "$MYSQLD_DEBUG" = yes; then
# add --log, --core-file and --debug
# but only if not already set in my.cnf
if ! $print_defaults mysqld | \
grep -q -e '--log$' -e '--log[[:blank:]=]'
then
debug_flags="--log=${log_query}"
fi
if ! $print_defaults mysqld | grep -q -e '^--debug\>' &&
test "$MYSQLD" = /usr/sbin/mysqld-debug
then
debug_flags="$debug_flags --debug=d:t:F:L:o,$datadir/mysqld.trace"
fi
if ! $print_defaults mysqld | grep -q -e '^--core-file\>'
then
debug_flags="$debug_flags --core-file"
fi
fi
# Creating parent directories for logs
for i in "$log_upgrade" "$log_query" "$log_error"; do
if [ "${i:0:1}" == "/" ]; then
log_dir="`dirname "$i"`"
if [ \! -d "$log_dir" ]; then
mkdir -p "$log_dir"
fi
chmod 770 "$log_dir"
chown -R --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$log_dir"
else
echo "Relative path \"$i\" for log found, skipping handling."
echo "Trusting sysadmin that he prepared everything and knows what to do."
echo "You've been warned, you are on your own with logs!"
fi
done
MYSQLVER="`echo @MYSQLVER@ | sed 's|\.[0-9]\+$||'`"
# We assume a fresh install if the directory $datadir/mysql
# does not exist and create the privilege database
if ! test -d "$datadir/mysql"; then
echo "Creating MySQL privilege database... "
mysql_install_db --user="$mysql_daemon_user" --datadir="$datadir" ||{
rc_failed; rc_status -v; rc_exit
}
echo -n "$MYSQLVER" > "$datadir"/mysql_upgrade_info
fi
check_obsolete
# Run mysql_upgrade on every package install/upgrade. Not always
# necessary, but doesn't do any harm. On big upgrade, require
# user confirmation.
if [ -f "$datadir/.run-mysql_upgrade" ]; then
echo > "$log_upgrade"
echo "`LANG="" date` - upgrading MySQL..." >> "$log_upgrade"
echo >> "$log_upgrade"
echo "Will update MySQL now, if you encounter any problems, please read following file:" | tee -a "$log_upgrade"
echo " /usr/share/doc/packages/mysql/README.SUSE" | tee -a "$log_upgrade"
sed -i -e 's|^\([[:blank:]]*\)skip-locking|\1skip-external-locking|' \
-e 's|^\([[:blank:]]*skip-federated\)|#\1|' /etc/my.cnf
[ -d /etc/mysql ] || \
sed -i 's|^\([[:blank:]]*!includedir\ /etc/mysql[[:blank:]]*\)$|#\1|' /etc/my.cnf
# Check logs for inconsistencies
SRCLOGS=""
ALL_SRCLOGS=""
for i in "$log_error" /var/lib/mysql/mysqld.log \
/var/log/mysqld.log ; do
if test -f "$i"; then
SRCLOGS="$i"
ALL_SRCLOGS="${ALL_SRCLOGS} ${i}"
fi
done
if [ "${ALL_SRCLOGS}" \!= " ${SRCLOGS}" ]; then
echo "Log files inconsistency, please merge following files manually:"
echo $ALL_SRCLOGS | sed 's|[[:blank:]]\+|\n|' | sed 's|^|\t|'
else
if [ "$SRCLOGS" ]; then
[ "$SRCLOGS" = "$log_error" ] || mv "$SRCLOGS" "$log_error"
fi
fi
check_obsolete >> "$log_upgrade"
# instead of running mysqld --bootstrap, which wouldn't allow
# us to run mysql_upgrade, we start a full-featured server with
# --skip-grant-tables and restict access to it by unix
# permissions of the named socket
protected="`cat /var/run/mysql/protecteddir 2> /dev/null`"
if [ -d "$protected" ]; then
pid="`cat "$protected/mysqld.pid" 2> /dev/null`"
if [ "$pid" ] && [ -d "/proc/$pid" ] &&
[ "`readlink "/proc/$pid/exe" | grep "mysql"`" ]; then
echo "Can't update as another updating process is currently running" | tee -a "$log_upgrade"
echo "Please check process $pid and terminate it before restarting MySQL" | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
else
rm -rf "$protected"
fi
fi
protected="`mktemp -d -p /var/tmp mysql-protected.XXXXXX | tee /var/run/mysql/protecteddir`"
export TMPDIR="$TEMPDIR"
# Run upgrade, double check
# We need to restart mysql every time as programs
# reloads privileges tables, so we can get lock out
for cmd in "/usr/bin/mysql_upgrade" \
"/usr/bin/mysql_upgrade"; do
[ -z "$protected" ] || chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$protected"
[ "`ls -ld "$protected" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || {
echo "Can't create secure $protected" | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
}
echo "Running protected MySQL... " | tee -a "$log_upgrade"
$MYSQLD \
$debug_flags \
--skip-networking \
--skip-grant-tables \
--datadir="$datadir" \
--user="$mysql_daemon_user" \
--log-error="$log_upgrade_run" \
--socket="$protected/mysql.sock" \
--pid-file="$protected/mysqld.pid" \
--group="$mysql_daemon_group" &>/dev/null &
wait_for_socket "$protected/mysql.sock" || {
echo "error: $protected/mysql.sock file didn't appeared... " | tee -a "$log_upgrade"
echo " Try checking \"$log_upgrade_run\"... " | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
}
if [ "`grep "Upgrading MySQL..." "$log_upgrade"`" ]; then
echo "Problems should be fixed now."
echo "Rechecking whether everything is Ok... " | tee -a "$log_upgrade"
LANG=C $cmd --no-defaults --force \
--socket="$protected/mysql.sock" | \
sed -e 's|^|\ \ \ |' | \
tee -a "$log_upgrade"
else
echo "Upgrading MySQL... " | tee -a "$log_upgrade"
LANG=C $cmd --no-defaults --force \
--socket="$protected/mysql.sock" | \
sed -e 's|^|\ \ \ |' \
-e 's|error|info|' \
-e 's|\(Table\ upgrade\ required.\).*|\1|' | \
tee -a "$log_upgrade"
fi
[ "$PIPESTATUS" -ne 0 ] && {
rc_failed; rc_status -v;
kill_mysql "$protected/mysqld.pid"
rc_exit; }
kill_mysql "$protected/mysqld.pid" || {
echo "error: Can't stop protected MySQL... " | tee -a "$log_upgrade"
rc_failed; rc_status -v;
kill_mysql "$protected/mysqld.pid"
rc_exit; }
# Everything went fine
if [ -z "`grep REPAIR "$log_upgrade"`" ] && \
[ -z "`grep "Table\ upgrade\ required" "$log_upgrade"`" ]; then
break
fi
done # end of upgrade
rm -rf "$protected"
# Fix ownerships and permissions for $datadir
chmod 750 "$datadir"
chown -R --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$datadir"
rm -f /var/adm/update-messages/mysql-*
[ "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ] || \
echo -n "@MYSQLVER@" > "$datadir/mysql_upgrade_info"
rm -f /var/lib/mysql/.run-mysql_upgrade
rm -f /var/lib/mysql/.force_upgrade
rm -f "$datadir"/{update-stamp-*,mysql/stamp-4.1} # used in the past
MYSQLVERSION="`mysqld --version 2> /dev/null | sed -n 's|mysqld[[:blank:]]\+Ver[[:blank:]]\+\([^[:blank:]]\+\)[[:blank:]].*|\1|p'`"
[ -z "$MYSQLVERSION" ] || echo "$MYSQLVERSION" > "$datadir"/mysql_upgrade_info
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$log_upgrade"
chmod 640 "$log_upgrade"
fi
export TMPDIR="$TEMPDIR"
echo -n "Starting service MySQL "
$SAFE_MYSQLD \
--mysqld=${MYSQLD#/usr/sbin/} \
$debug_flags \
--user="$mysql_daemon_user" \
--pid-file="$pid_file" \
--socket="$socket" \
--datadir="$datadir" &>/dev/null &
wait_for_socket "$socket" || {
# let's not treat this as a fatal error
echo "warning: $socket didn't appear within 30 seconds"
}
chmod a+r "$pid_file"
# Rmember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down service MySQL "
kill_mysql
if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then
rm -rf "$TEMPDIR"
fi
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
"$MYSELF" status >/dev/null && "$MYSELF" restart
# Remember status and be quiet
rc_status
;;
restart|force-reload)
echo "Restarting service MySQL "
"$MYSELF" stop
"$MYSELF" start
rc_status
;;
reload)
echo -n "Reloading service MySQL "
kill -HUP "`cat "$pid_file"`"
touch "$pid_file"
rc_status -v
;;
check|status)
echo -n "Checking for service MySQL: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values,
# but it checks for running binary first and only
# if it doesn't find running process with proper
# name it checks pidfile. So we can't use it because
# akonadi runs it's own database.
# checkproc -p $pid_file $MYSQLD
if [ -f "$pid_file" ]; then
if ! [ -e /proc/version ]; then
mount -n -t proc proc /proc
test -e /proc/version || set_return_value 100
fi
pid="`cat "$pid_file"`"
if [ "$pid" ] && [ -d "/proc/$pid" ]; then
cmd=`cat "/proc/$pid/cmdline" 2> /dev/null`
exe=`readlink "/proc/$pid/exe" 2> /dev/null`
if [ "`echo "$exe" | grep "^$MYSQLD"`" ] || [ "`echo "$cmd" | grep "^$MYSQLD"`" ]; then
set_return_value 0
else
set_return_value 1
fi
else
set_return_value 1
fi
else
set_return_value 3
fi
rc_status -v
;;
*)
echo "Usage: $MYSELF {start|stop|status|reload|restart|try-restart|force-reload}"
exit 1
;;
esac
fi
rc_exit
# vim: ft=sh

View File

@ -1,614 +0,0 @@
#!/bin/bash
# Copyright (c) 1995-2014 SuSE Linux AG Nuernberg, Germany.
#
# Author: Lenz Grimmer
# Maintainer: Michal Hrusecky <mhrusecky@suse.cz>
#
# mysqld_multi extension added by Richard Bos, 2008
#
# /etc/init.d/mysql
#
# and its symbolic link
#
# /usr/sbin/rcmysql
#
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop:
# Short-Description: Start the MySQL database server
# Description: Start the MySQL database server
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
# Check for the location of initscript
if [ "`echo "$0" | grep "^\."`" ] || [ "`echo "$0" | grep "^[^/].*/"`" ]; then
MYSELF="`pwd`/$0"
else
MYSELF="$0"
fi
parse_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--datadir=*) datadir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--pid-file=*) pid_file="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--socket=*) socket="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--log-error=*) log_error="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--user=*) mysql_daemon_user="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
--group=*) mysql_daemon_group="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;;
esac
done
}
wait_for_socket()
{
local i
for((i=0; i<150; i++)); do
sleep 0.2
test -S $1 && i='' && break
done
test -z "$i" || return 1
return 0
}
# Don't run killproc -TERM, as it could send a SIGKILL as well, possibly
# resulting in database corruption. Run kill -TERM manually instead, wait
# approximately 300 seconds and fail if mysql doesn't respond. This will at
# least prevent the SIGKILL when doing 'rcmysql stop' manually. During system
# shutdown, we are out of luck...
# See https://bugzilla.novell.com/show_bug.cgi?id=223209
kill_mysql ()
{
local pid exe test_pid_file
if [ "$1" ]; then
test_pid_file="$1"
else
test_pid_file="$pid_file"
fi
test -e "$test_pid_file" || return 7 # not running
pid=`cat "$test_pid_file"` || return 4 # insufficient privileges
if ! test -e /proc/version; then
mount -n -t proc proc /proc
test -e /proc/version || return 100
fi
test -L "/proc/$pid/exe" || return 7
exe=`readlink "/proc/$pid/exe"` || return 4
test "`echo "$exe" | grep "^$MYSQLD"`" || return 7
kill -STOP "$pid"
kill -TERM "$pid" || return 4 # suboptimal
kill -CONT "$pid"
for i in `seq 3000`; do
# mysqld removes its pid file
test -e "$test_pid_file" || return 0
LC_ALL=C sleep 0.1
done
test -e "$test_pid_file" || return 0
return 1
}
# Helper function which can end with any status
set_return_value() {
return $1
}
# Checks for obsolete database
check_obsolete() {
# check for ISAM tables
tables="`find "$datadir" -name '*.ISM' 2> /dev/null | sed "s@$datadir/*@@; s@.ISM@@; s@/@.@;"`"
if test "$tables" ; then
echo
echo "Some tables still use ISAM format, which is NO LONGER SUPPORTED"
echo "since mysql 5.0. To use these tables, you would need to open them"
echo "from an older mysql server and convert to something better (eg. MyISAM)."
echo
echo "Tables using ISAM are: "
echo " $tables "
echo
fi
# check for bdb tables
tables="`find "$datadir" -name '*.db' 2> /dev/null | sed "s@$datadir/*@@; s@.db@@; s@/@.@;"`"
if test -n "$tables" ; then
echo
echo "Some tables still use BerkeleyDB format, which is NO LONGER SUPPORTED"
echo "since mysql 5.1. To use these tables, you would need to open them"
echo "from an older mysql server and convert to something better (eg. MyISAM)."
echo
echo "Tables using BerkeleyDB are: "
echo " $tables "
echo
fi
}
# Check if we want to run multiple instances.
[[ "`cat /etc/my.cnf | sed -n 's|^[[:blank:]]*\[mysqld[0-9]\+\]|yes|p'`" ]] && MYSQLD_MULTI=yes
# This was old way how to specify this, left for backward compatibility.
[[ -f /etc/sysconfig/mysql ]] && . /etc/sysconfig/mysql
if [[ "$MYSQLD_MULTI" == "yes" ]]; then
[[ -x /usr/bin/mysqld_multi ]] || {
echo -n "MySQL: /usr/bin/mysqld_multi not found"
rc_failed 5; rc_status -v; rc_exit;
}
case "$1" in
start)
# FIXME:
# We assume a fresh install if the directory $datadir/mysql
# does not exist and create the privilege database
# if ! test -d $datadir/mysql; then
# echo -n "Creating MySQL privilege database... "
# mysql_install_db --user=$mysql_daemon_user --datadir=$datadir || {
# rc_failed; rc_status -v; rc_exit
# }
# fi
echo -n "Starting service multi MySQL "
mysqld_multi start
for((i=0; i<150; i++)); do
sleep 0.2
[ "`mysqld_multi report | grep 'is not running'`" ] || break
done
if [ "`mysqld_multi report | grep 'is not running'`" ]; then
echo "Failed to start all instances"
mysqld_multi report
rc_failed; rc_status -v; rc_exit
fi
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down service multi MySQL "
mysqld_multi stop
for((i=0; i<150; i++)); do
sleep 0.2
[ "`mysqld_multi report | grep 'is running'`" ] || break
done
if [ "`mysqld_multi report | grep 'is running'`" ]; then
echo "Failed to stop all instances"
mysqld_multi report
rc_failed; rc_status -v; rc_exit
fi
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
"$MYSELF" status >/dev/null && "$MYSELF" restart
# Remember status and be quiet
rc_status
;;
restart|force-reload)
echo "Restarting service multi MySQL "
"$MYSELF" stop
"$MYSELF" start
rc_status
;;
reload)
echo -n "Reloading service multi MySQL "
mysqld_multi reload
rc_status -v
;;
status)
STATUS=$(mysqld_multi report)
echo -n "$STATUS"
# Set the status for rc_status
echo "$STATUS" | grep -q "is running"
rc_status -v
;;
*)
echo "Usage: $MYSELF {start|stop|status|reload|restart|try-restart|force-reload}"
exit 1
;;
esac
else
# Test, if mysqld or mysql-max actually exist
unset MYSQLD
# use mysqld-debug only if explicitly requested (TODO: sysconfig variable?)
if test "$MYSQLD_DEBUG" = yes -a -x /usr/sbin/mysqld
then
MYSQLD=/usr/sbin/mysqld
elif test -x /usr/sbin/mysqld-max
then
MYSQLD=/usr/sbin/mysqld-max
elif test -x /usr/sbin/mysqld
then
MYSQLD=/usr/sbin/mysqld
fi
test "$MYSQLD" || {
echo -n "Nor /usr/sbin/mysqld nor /usr/sbin/mysqld-max exists";
rc_failed 5; rc_status -v; rc_exit;
}
# The following section has been taken from
# the original MySQL init script
# Note: If you want to change these variables, you'll make your life easier
# if you do so in /etc/my.cnf, which is preserved during upgrades
basedir=/usr
datadir=/var/lib/mysql
mysql_daemon_user=mysql
mysql_daemon_group=mysql
pid_file=/var/run/mysql/mysqld.pid
socket=/var/run/mysql/mysql.sock
print_defaults=/usr/bin/my_print_defaults
log_error=/var/log/mysql/mysqld.log
mode=$1 # start or stop
log_base="`echo "$log_error" | sed 's|\.log$||'`"
[ "$log_base" \!= "$log_error" ] || log_base="/var/log/mysql/mysql"
log_upgrade="${log_base}-upgrade.log"
log_upgrade_run="${log_base}-upgrade-run.log"
log_query="${log_base}-query.log"
parse_arguments `$print_defaults $defaults mysqld mysql_server`
mkdir -m 755 -p /var/run/mysql
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" /var/run/mysql
export TEMPDIR="`cat /var/run/mysql/tmpdir 2> /dev/null`"
# Safeguard (relative paths, core dumps..)
cd "$basedir"
case "$1" in
start)
# exit gracefully, if we are already running
"$MYSELF" status >/dev/null && echo -n "Starting service MySQL " && \
rc_status -v && rc_exit
# prepare tmp dir
unset TMPDIR
if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then
rm -rf "$TEMPDIR"
fi
TEMPDIR="`mktemp -d -p /var/tmp mysql.XXXXXX | tee /var/run/mysql/tmpdir`"
[ -z "$TEMPDIR" ] || chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$TEMPDIR"
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || {
echo "Can't create secure $TEMPDIR"
rc_failed; rc_status -v; rc_exit;
}
# Test, if safe_mysqld actually exists
SAFE_MYSQLD=/usr/bin/mysqld_safe
test -x $SAFE_MYSQLD || {
echo "$SAFE_MYSQLD does not exist ";
rc_failed 5; rc_status -v; rc_exit;
}
debug_flags=""
if test "$MYSQLD_DEBUG" = yes; then
# add --log, --core-file and --debug
# but only if not already set in my.cnf
if ! $print_defaults mysqld | \
grep -q -e '--log$' -e '--log[[:blank:]=]'
then
debug_flags="--log=${log_query}"
fi
if ! $print_defaults mysqld | grep -q -e '^--debug\>' &&
test "$MYSQLD" = /usr/sbin/mysqld-debug
then
debug_flags="$debug_flags --debug=d:t:F:L:o,$datadir/mysqld.trace"
fi
if ! $print_defaults mysqld | grep -q -e '^--core-file\>'
then
debug_flags="$debug_flags --core-file"
fi
fi
# Creating parent directories for logs
for i in "$log_upgrade" "$log_query" "$log_error"; do
if [ "${i:0:1}" == "/" ]; then
log_dir="`dirname "$i"`"
if [ \! -d "$log_dir" ]; then
mkdir -p "$log_dir"
fi
chmod 770 "$log_dir"
chown -R --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$log_dir"
else
echo "Relative path \"$i\" for log found, skipping handling."
echo "Trusting sysadmin that he prepared everything and knows what to do."
echo "You've been warned, you are on your own with logs!"
fi
done
MYSQLVER="`echo @MYSQLVER@ | sed 's|\.[0-9]\+$||'`"
# We assume a fresh install if the directory $datadir/mysql
# does not exist and create the privilege database
if ! test -d "$datadir/mysql"; then
echo "Creating MySQL privilege database... "
mysql_install_db --user="$mysql_daemon_user" --datadir="$datadir" ||{
rc_failed; rc_status -v; rc_exit
}
echo -n "$MYSQLVER" > "$datadir"/mysql_upgrade_info
fi
check_obsolete
# Run mysql_upgrade on every package install/upgrade. Not always
# necessary, but doesn't do any harm. On big upgrade, require
# user confirmation.
if [ -f "$datadir/.run-mysql_upgrade" ]; then
echo > "$log_upgrade"
echo "`LANG="" date` - upgrading MySQL..." >> "$log_upgrade"
echo >> "$log_upgrade"
echo "Will update MySQL now, if you encounter any problems, please read following file:" | tee -a "$log_upgrade"
echo " /usr/share/doc/packages/mysql/README.SUSE" | tee -a "$log_upgrade"
sed -i -e 's|^\([[:blank:]]*\)skip-locking|\1skip-external-locking|' \
-e 's|^\([[:blank:]]*skip-federated\)|#\1|' /etc/my.cnf
[ -d /etc/mysql ] || \
sed -i 's|^\([[:blank:]]*!includedir\ /etc/mysql[[:blank:]]*\)$|#\1|' /etc/my.cnf
# Check logs for inconsistencies
SRCLOGS=""
ALL_SRCLOGS=""
for i in "$log_error" /var/lib/mysql/mysqld.log \
/var/log/mysqld.log ; do
if test -f "$i"; then
SRCLOGS="$i"
ALL_SRCLOGS="${ALL_SRCLOGS} ${i}"
fi
done
if [ "${ALL_SRCLOGS}" \!= " ${SRCLOGS}" ]; then
echo "Log files inconsistency, please merge following files manually:"
echo $ALL_SRCLOGS | sed 's|[[:blank:]]\+|\n|' | sed 's|^|\t|'
else
if [ "$SRCLOGS" ]; then
[ "$SRCLOGS" = "$log_error" ] || mv "$SRCLOGS" "$log_error"
fi
fi
check_obsolete >> "$log_upgrade"
# instead of running mysqld --bootstrap, which wouldn't allow
# us to run mysql_upgrade, we start a full-featured server with
# --skip-grant-tables and restict access to it by unix
# permissions of the named socket
protected="`cat /var/run/mysql/protecteddir 2> /dev/null`"
if [ -d "$protected" ]; then
pid="`cat "$protected/mysqld.pid" 2> /dev/null`"
if [ "$pid" ] && [ -d "/proc/$pid" ] &&
[ "`readlink "/proc/$pid/exe" | grep "mysql"`" ]; then
echo "Can't update as another updating process is currently running" | tee -a "$log_upgrade"
echo "Please check process $pid and terminate it before restarting MySQL" | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
else
rm -rf "$protected"
fi
fi
protected="`mktemp -d -p /var/tmp mysql-protected.XXXXXX | tee /var/run/mysql/protecteddir`"
export TMPDIR="$TEMPDIR"
# Run upgrade, double check
# We need to restart mysql every time as programs
# reloads privileges tables, so we can get lock out
for cmd in "/usr/bin/mysql_upgrade" \
"/usr/bin/mysql_upgrade"; do
[ -z "$protected" ] || chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$protected"
[ "`ls -ld "$protected" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || {
echo "Can't create secure $protected" | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
}
echo "Running protected MySQL... " | tee -a "$log_upgrade"
$MYSQLD \
$debug_flags \
--skip-networking \
--skip-grant-tables \
--datadir="$datadir" \
--user="$mysql_daemon_user" \
--log-error="$log_upgrade_run" \
--socket="$protected/mysql.sock" \
--pid-file="$protected/mysqld.pid" \
--group="$mysql_daemon_group" &>/dev/null &
wait_for_socket "$protected/mysql.sock" || {
echo "error: $protected/mysql.sock file didn't appeared... " | tee -a "$log_upgrade"
echo " Try checking \"$log_upgrade_run\"... " | tee -a "$log_upgrade"
touch /var/lib/mysql/.run-mysql_upgrade
rc_failed; rc_status -v; rc_exit;
}
if [ "`grep "Upgrading MySQL..." "$log_upgrade"`" ]; then
echo "Problems should be fixed now."
echo "Rechecking whether everything is Ok... " | tee -a "$log_upgrade"
LANG=C $cmd --no-defaults --force \
--socket="$protected/mysql.sock" | \
sed -e 's|^|\ \ \ |' | \
tee -a "$log_upgrade"
else
echo "Upgrading MySQL... " | tee -a "$log_upgrade"
LANG=C $cmd --no-defaults --force \
--socket="$protected/mysql.sock" | \
sed -e 's|^|\ \ \ |' \
-e 's|error|info|' \
-e 's|\(Table\ upgrade\ required.\).*|\1|' | \
tee -a "$log_upgrade"
fi
[ "$PIPESTATUS" -ne 0 ] && {
rc_failed; rc_status -v;
kill_mysql "$protected/mysqld.pid"
rc_exit; }
kill_mysql "$protected/mysqld.pid" || {
echo "error: Can't stop protected MySQL... " | tee -a "$log_upgrade"
rc_failed; rc_status -v;
kill_mysql "$protected/mysqld.pid"
rc_exit; }
# Everything went fine
if [ -z "`grep REPAIR "$log_upgrade"`" ] && \
[ -z "`grep "Table\ upgrade\ required" "$log_upgrade"`" ]; then
break
fi
done # end of upgrade
rm -rf "$protected"
# Fix ownerships and permissions for $datadir
chmod 750 "$datadir"
chown -R --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$datadir"
rm -f /var/adm/update-messages/mysql-*
[ "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ] || \
echo -n "@MYSQLVER@" > "$datadir/mysql_upgrade_info"
rm -f /var/lib/mysql/.run-mysql_upgrade
rm -f /var/lib/mysql/.force_upgrade
rm -f "$datadir"/{update-stamp-*,mysql/stamp-4.1} # used in the past
MYSQLVERSION="`mysqld --version 2> /dev/null | sed -n 's|mysqld[[:blank:]]\+Ver[[:blank:]]\+\([^[:blank:]]\+\)[[:blank:]].*|\1|p'`"
[ -z "$MYSQLVERSION" ] || echo "$MYSQLVERSION" > "$datadir"/mysql_upgrade_info
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$log_upgrade"
chmod 640 "$log_upgrade"
fi
export TMPDIR="$TEMPDIR"
echo -n "Starting service MySQL "
$SAFE_MYSQLD \
--mysqld=${MYSQLD#/usr/sbin/} \
$debug_flags \
--user="$mysql_daemon_user" \
--pid-file="$pid_file" \
--socket="$socket" \
--datadir="$datadir" &>/dev/null &
wait_for_socket "$socket" || {
# let's not treat this as a fatal error
echo "warning: $socket didn't appear within 30 seconds"
}
chmod a+r "$pid_file"
# Rmember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down service MySQL "
kill_mysql
if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \
[ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then
rm -rf "$TEMPDIR"
fi
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
"$MYSELF" status >/dev/null && "$MYSELF" restart
# Remember status and be quiet
rc_status
;;
restart|force-reload)
echo "Restarting service MySQL "
"$MYSELF" stop
"$MYSELF" start
rc_status
;;
reload)
echo -n "Reloading service MySQL "
kill -HUP "`cat "$pid_file"`"
touch "$pid_file"
rc_status -v
;;
check|status)
echo -n "Checking for service MySQL: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values,
# but it checks for running binary first and only
# if it doesn't find running process with proper
# name it checks pidfile. So we can't use it because
# akonadi runs it's own database.
# checkproc -p $pid_file $MYSQLD
if [ -f "$pid_file" ]; then
if ! [ -e /proc/version ]; then
mount -n -t proc proc /proc
test -e /proc/version || set_return_value 100
fi
pid="`cat "$pid_file"`"
if [ "$pid" ] && [ -d "/proc/$pid" ]; then
cmd=`cat "/proc/$pid/cmdline" 2> /dev/null`
exe=`readlink "/proc/$pid/exe" 2> /dev/null`
if [ "`echo "$exe" | grep "^$MYSQLD"`" ] || [ "`echo "$cmd" | grep "^$MYSQLD"`" ]; then
set_return_value 0
else
set_return_value 1
fi
else
set_return_value 1
fi
else
set_return_value 3
fi
rc_status -v
;;
*)
echo "Usage: $MYSELF {start|stop|status|reload|restart|try-restart|force-reload}"
exit 1
;;
esac
fi
rc_exit
# vim: ft=sh

5
series
View File

@ -10,8 +10,11 @@ mariadb-5.2.3-cnf.patch
mysql-community-server-5.5.6-safe-process-in-bin.patch
mariadb-10.0.17-group.patch
mariadb-10.0.5-deharcode-libdir.patch
mariadb-10.0.15-upgrade-datadir.patch
mysql-community-server-5.6.12-srv_buf_size.patch
mariadb-10.0.16-header_files_const_warnings.patch
mariadb-10.0.15-fortify-and-O.patch
mariadb-10.0.15-logrotate-su.patch
mariadb-5.5.41-mariadb-admincrash.patch
mariadb-10.0.15-covscan-signexpr.patch
mariadb-10.0.10-string-overflow.patch
mariadb-10.0.20-tabxml-bufferoverflowstrncat.patch

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# Test the SUSE mysql(-Max) package using the MySQL testsuite
# Test the SUSE mysql package using the MySQL testsuite
my $id = getpwnam("mysql") or die "can't find user \"mysql\": $!";
my $dir = "/usr/share/mysql-test/";