SHA256
1
0
forked from pool/mariadb

- Updating to 10.0 branch of MariaDB

* https://mariadb.com/kb/en/what-is-mariadb-100/
- Many additional fixes like basic systemd support

OBS-URL: https://build.opensuse.org/package/show/server:database/mariadb?expand=0&rev=145
This commit is contained in:
Michal Hrusecky (old before rename to _miska_) 2014-05-23 07:29:50 +00:00 committed by Git OBS Bridge
parent 6ae207407d
commit 178f6407c7
13 changed files with 829 additions and 54 deletions

20
README.install Normal file
View File

@ -0,0 +1,20 @@
You just installed MySQL server for the first time.
You can start it using:
rcmysql start
During first start empty database will be created for your automatically.
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'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

View File

@ -10,7 +10,7 @@ export EXTRA_FLAGS=" -Wno-unused-but-set-variable -fno-strict-aliasing -Wno-unus
export EXTRA_FLAGS=" -mminimal-toc "
%endif
export CFLAGS="$RPM_OPT_FLAGS -DOPENSSL_LOAD_CONF -DPIC -fPIC -DFORCE_INIT_OF_VARS $EXTRA_FLAGS "
export CXXFLAGS="$CFLAGS -fno-exceptions -fno-rtti"
export CXXFLAGS="$CFLAGS"
%if 0%{use_cmake} < 1
autoreconf -f -i
@ -101,6 +101,7 @@ BuildMySQL() {
shift
cmake -DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBEVENT=system \
-DWITH_JEMALLOC=no \
-DWITH_READLINE=0 \
-DWITH_LIBEDIT=0 \
@ -124,5 +125,5 @@ BuildMySQL() {
}
BuildMySQL "" -DCMAKE_BUILD_TYPE=Release -DINSTALL_SQLBENCHDIR=share
BuildMySQL "-debug" -DCMAKE_BUILD_TYPE=Debug
BuildMySQL "-debug" -DCMAKE_BUILD_TYPE=Debug -DWITHOUT_TOKUDB=1
%endif

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d2dececd5b4555523534954a2ca936322440699114cc12b5caf9dfc21ce42e05
size 318
oid sha256:f58c6f356cfb58f906c9610b7708a35e19f65b829756b231cae48f1f56c636c3
size 316

View File

@ -41,14 +41,14 @@ filelist()
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 resolve_stack_dump resolveip {m,}aria_chk {m,}aria_dump_log {m,}aria_ftdump {m,}aria_pack {m,}aria_read_log xtstat >mysql.files
filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow >mysql-client.files
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 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 >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_config_editor 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 >mysql-tools.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 >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
@ -75,7 +75,6 @@ DOCS=(COPYING README EXCEPTIONS-CLIENT %_sourcedir/README.debug %_sourcedir/READ
DOCDIR=%buildroot%_defaultdocdir/%name
install -d -m 755 ${DOCDIR}
install -d -m 755 %buildroot/etc/logrotate.d
install -d -m 755 %buildroot/etc/init.d
install -m 644 _build/support-files/mysql-log-rotate %buildroot/etc/logrotate.d/mysql
%if 0%{?prefered} > 0%{?use_cmake}
install -m 644 _buildlibmysqld/*.so* %buildroot%_libdir
@ -83,13 +82,24 @@ ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so.0
ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so
%endif
install -m 660 %{S:14} %buildroot/etc/my.cnf
install -m 640 scripts/mysqlaccess.conf %buildroot/etc/mysqlaccess.conf
[ \! -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 -m 755 %_sourcedir/rc.mysql-multi %buildroot/etc/init.d/mysql
sed -i 's|@MYSQLVER@|%{version}|' %buildroot/etc/init.d/mysql
ln -sf ../../etc/init.d/mysql %buildroot/usr/sbin/rcmysql
%if 0%{?suse_version} >= 1210 && 0%{?use_systemd} > 0
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
%else
install -d -m 755 '%buildroot'/etc/init.d
install -m 755 '%_sourcedir'/rc.mysql.sysvinit '%buildroot'/etc/init.d/mysql
sed -i 's|@MYSQLVER@|%{version}|' '%buildroot'/etc/init.d/mysql
ln -sf ../../etc/init.d/mysql '%buildroot'/usr/sbin/rcmysql
sed -i 's|doc/packages/mysql|doc/packages/%{name}|g' '%buildroot'/etc/init.d/mysql
%endif
# this is used by the init script
install -m 755 -d %buildroot/var/run/mysql
# SuSEfirewall service description
@ -132,7 +142,6 @@ rm -rf '%buildroot'/%_datadir/man/*/mysql_config.1*
rm -rf '%buildroot'/%_includedir
rm -rf '%buildroot'/%_datadir/aclocal
%endif
sed -i 's|doc/packages/mysql|doc/packages/%{name}|g' '%buildroot'/etc/init.d/mysql
ln -s mysqlcheck '%buildroot'%_bindir/mysqlrepair
ln -s mysqlcheck '%buildroot'%_bindir/mysqlanalyze
ln -s mysqlcheck '%buildroot'%_bindir/mysqloptimize
@ -143,12 +152,14 @@ ln -s libndbclient.so.6.0.0 '%buildroot'%_libdir/libndbclient.so.6
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

3
mariadb-10.0.11.tar.bz2 Normal file
View File

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

View File

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

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 23 09:04:30 CEST 2014 - mhrusecky@suse.cz
- Updating to 10.0 branch of MariaDB
* https://mariadb.com/kb/en/what-is-mariadb-100/
- Many additional fixes like basic systemd support
-------------------------------------------------------------------
Wed May 14 05:45:51 UTC 2014 - coolo@suse.com

View File

@ -16,13 +16,14 @@
#
# Few definitions which will alter build
%define prefered 01
%define use_cmake 01
%define cluster 00
%define have_info 0
%define prefered 01
%define use_systemd 01
%define use_cmake 01
%define cluster 00
%define have_info 0
%define builtin_plugins partition,csv,heap,aria,pbxt,myisam,myisammrg,xtradb
%define use_extra_provides 1
%define extra_provides mariadb_55
%define extra_provides mariadb_100
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
@ -39,16 +40,16 @@ Name: mariadb
Summary: Server part of MariaDB
License: SUSE-GPL-2.0-with-FLOSS-exception
Group: Productivity/Databases/Servers
Version: 5.5.33
Version: 10.0.11
Release: 0
%define srv_vers 5.5.33
%define srv_vers 5.6.17
Url: http://www.mariab.org
Source: mariadb-%{version}.tar.bz2
Source2: baselibs.conf
Source3: README.debug
Source4: suse-test-run
Source5: mysql.SuSEfirewall2
Source7: rc.mysql-multi
Source7: README.install
Source8: README.SuSE
Source9: mysql-patches.tar.bz2
Source10: build.inc
@ -56,6 +57,9 @@ Source11: install.inc
Source12: series
Source13: configuration-tweaks.tar.bz2
Source14: my.ini
Source15: rc.mysql.sysvinit
Source16: rc.mysql.systemd
Source17: mysql.service
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
PreReq: pwdutils
@ -404,15 +408,14 @@ sed -i 's|@localstatedir@|/var/log|' support-files/mysql-log-rotate.sh
%if 0%{prefered} < 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
done
%endif
# Broken test that needs sources
rm -f mysql-test/t/file_contents.test mysql-test/r/file_contents.result
# Present only in newer MariaDB, big change, needs fixing & testing
rm -rf storage/tokudb
# Specify perl path on shebangs
for i in `grep -Rl '^#!@PERL@$' .`; do
sed -i 's|#!@PERL@|/usr/bin/perl|' $i
sed -i 's|@PERL@|/usr/bin/perl|' $i
done
%build
@ -447,14 +450,13 @@ done
# preun and posttran takes care of restart #
#######################################################################
%preun
[ $1 = 1 ] || /usr/sbin/rcmysql stop
[ $1 = 1 ] || /usr/sbin/rcmysql stop || true
%pretrans -p <lua>
if posix.access("/usr/sbin/rcmysql", "x") then
restart = os.execute("/usr/sbin/rcmysql status > /dev/null")
os.execute("/usr/sbin/rcmysql stop")
if restart == 0 then
os.execute("/usr/sbin/rcmysql stop")
os.execute("/bin/mkdir -p %{_rundir}/mysql/restart")
end
end
@ -476,6 +478,17 @@ if [ "`ls /etc/rc.d/rc*.d/S*mysql 2> /dev/null`" ] || [ -d %{_rundir}/mysql/rest
[ -x /usr/sbin/rcmysql ] && /usr/sbin/rcmysql start
rmdir %{_rundir}/mysql/restart || :
fi
# warn on first run
datadir="/var/lib/mysql"
if [ -x /usr/bin/my_print_defaults ]; then
datadir="`/usr/bin/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
[ "$datadir" ] || datadir="/var/lib/mysql"
fi
if [ \! -d "$datadir/mysql" ]; then
cat > /var/adm/update-messages/%{name}-%{version}-%{release} << EOF
%(cat %_sourcedir/README.install)
EOF
fi
#######################################################################
# Various ldconfig post scripts #
@ -527,7 +540,13 @@ fi
%if %have_info
%doc %{_infodir}/mysql.info.*
%endif
%if 0%{?suse_version} >= 1210 && 0%{?use_systemd} > 0
%dir /usr/lib/mysql
/usr/lib/mysql/rcmysql
/usr/lib/systemd/system/mysql.service
%else
/etc/init.d/mysql
%endif
/usr/sbin/rcmysql
%dir /usr/share/%{name}
%dir /usr/share/mysql
@ -546,12 +565,13 @@ fi
%files client -f mysql-client.files
%defattr(-, root, root)
%config(noreplace) %attr(0640, root, mysql) /etc/mysqlaccess.conf
%if 0%{prefered} > 0
%files -n libmysqlclient-devel -f libmysqlclient-devel.files
%defattr(-, root, root)
/usr/include/mysql
%{_libdir}/libmysqlclient.so
%{_libdir}/libmysqlclient_r.so
%dir /usr/share/aclocal
/usr/share/aclocal/mysql.m4
@ -567,7 +587,7 @@ fi
%files -n libmysqlclient18
%defattr(-, root, root)
%{_libdir}/libmysqlclient.so*
%{_libdir}/libmysqlclient.so.*
%if 0%{cluster} > 1
%files -n libndbclient6
@ -577,7 +597,7 @@ fi
%files -n libmysqlclient_r18
%defattr(-, root, root)
%{_libdir}/libmysqlclient_r.so*
%{_libdir}/libmysqlclient_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:5e9984c1676d989cc011b229902b741f17d35b4c547a8a57d3f32e9f9ed66a92
size 12386
oid sha256:ccb241bbd329ca03ce33a169ddbddb99deae969936912d4024abda64706439a9
size 13070

12
mysql.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=MySQL server
Wants=basic.target
After=basic.target network.target
[Service]
Type=forking
ExecStart=/usr/lib/mysql/rcmysql start
ExecStop=/usr/lib/mysql/rcmysql stop
[Install]
WantedBy=multi-user.target

679
rc.mysql.systemd Normal file
View File

@ -0,0 +1,679 @@
#!/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_check ()
{
_rc_status_ret=$?
test "_rc_status_ret" || _rc_status_ret=0
test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret
test $_rc_status -eq 0 || _rc_status_all=$_rc_status
return 0$_rc_status_ret
}
rc_status ()
{
rc_check
_rc_status_ret=$_rc_status
local i
for i ; do
case "$i" 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
done
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-debug
then
MYSQLD=/usr/sbin/mysqld-debug
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 "/var/lib/mysql/.run-mysql_upgrade" ]; then
if [ \! -f "/var/lib/mysql/.force_upgrade" ] && \
[ -f "$datadir/mysql_upgrade_info" ] && \
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
echo
echo "You are upgrading from different stable version of MySQL!"
echo "Make sure you to make backup of your data (mostly $datadir)!"
echo
echo "If you want to continue upgrading your database, run following commands:"
echo
echo " touch /var/lib/mysql/.force_upgrade"
echo " rcmysql restart"
echo
rc_failed; rc_status -v; rc_exit
fi
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"
$SAFE_MYSQLD \
--mysqld=${MYSQLD#/usr/sbin/} \
$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
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,5 +1,5 @@
#!/bin/bash
# Copyright (c) 1995-2011 SuSE Linux AG Nuernberg, Germany.
# Copyright (c) 1995-2014 SuSE Linux AG Nuernberg, Germany.
#
# Author: Lenz Grimmer
# Maintainer: Michal Hrusecky <mhrusecky@suse.cz>
@ -45,7 +45,7 @@ rc_reset
# 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
@ -160,7 +160,7 @@ check_obsolete() {
if [[ "$MYSQLD_MULTI" == "yes" ]]; then
[[ -x /usr/bin/mysqld_multi ]] || {
echo -n "MySQL: /usr/bin/mysqld_multi not found"
echo -n "MySQL: /usr/bin/mysqld_multi not found"
rc_failed 5; rc_status -v; rc_exit;
}
@ -178,6 +178,15 @@ if [[ "$MYSQLD_MULTI" == "yes" ]]; then
# 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
@ -186,13 +195,21 @@ if [[ "$MYSQLD_MULTI" == "yes" ]]; then
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
## 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
@ -214,7 +231,7 @@ if [[ "$MYSQLD_MULTI" == "yes" ]]; then
mysqld_multi reload
rc_status -v
;;
status)
STATUS=$(mysqld_multi report)
echo -n "$STATUS"
@ -326,12 +343,18 @@ else
# Creating parent directories for logs
for i in "$log_upgrade" "$log_query" "$log_error"; do
log_dir="`dirname "$i"`"
if [ \! -d "$log_dir" ]; then
mkdir -p "$log_dir"
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
chmod 770 "$log_dir"
chown -R --no-dereference mysql:mysql "$log_dir"
done
MYSQLVER="`echo @MYSQLVER@ | sed 's|\.[0-9]\+$||'`"
@ -347,7 +370,7 @@ else
fi
check_obsolete
# Run mysql_upgrade on every package install/upgrade. Not always
# necessary, but doesn't do any harm. On big upgrade, require
# necessary, but doesn't do any harm. On big upgrade, require
# user confirmation.
if [ -f "/var/lib/mysql/.run-mysql_upgrade" ]; then
if [ \! -f "/var/lib/mysql/.force_upgrade" ] && \
@ -415,7 +438,7 @@ else
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
@ -493,12 +516,12 @@ else
rm -f "$datadir"/{update-stamp-*,mysql/stamp-4.1} # used in the past
chown --no-dereference "$mysql_daemon_user:$mysql_daemon_group" "$log_upgrade"
chmod 640 "$log_upgrade"
fi
fi
export TMPDIR="$TEMPDIR"
echo -n "Starting service MySQL "
$SAFE_MYSQLD \
--mysqld=${MYSQLD#/usr/sbin/} \
$debug_flags \
@ -529,7 +552,7 @@ else
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## 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
@ -552,7 +575,7 @@ else
touch "$pid_file"
rc_status -v
;;
check|status)
echo -n "Checking for service MySQL: "
## Check status with checkproc(8), if process is running

6
series
View File

@ -8,6 +8,8 @@ mariadb-5.5.25-mysqld_multi-features.patch
mariadb-5.5.32-upgrade-exit-status.patch
mariadb-5.2.3-cnf.patch
mysql-community-server-5.5.6-safe-process-in-bin.patch
mariadb-5.5.28-group.patch
mariadb-5.5.33-deharcode-libdir.patch
mariadb-10.0.11-group.patch
mariadb-10.0.5-deharcode-libdir.patch
mysql-5.5.31-upgrade-datadir.patch
mysql-community-server-5.6.12-srv_buf_size.patch
mariadb-10.0.9-perl-in-bench.patch