Commit 26656115 authored by Joerg Bruehe's avatar Joerg Bruehe

Spec file for "generic" RPMs:

Cleanup, formatting improvements,
vendor is Sun (since MySQL AB was bought).

Backport the change so that RPM doesn't magically
create a dependency on "Perl-DBI".
parent 14afe5c4
...@@ -14,36 +14,23 @@ ...@@ -14,36 +14,23 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA. # MA 02110-1301 USA.
%define mysql_version @VERSION@ ##############################################################################
%define mysql_vendor MySQL AB # Some common macro definitions
##############################################################################
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) # NOTE: "vendor" is used in upgrade/downgrade check, so you can't
# to enable static linking (off by default) # change these, has to be exactly as is.
%{?_with_static:%define STATIC_BUILD 1} %define mysql_old_vendor MySQL AB
%{!?_with_static:%define STATIC_BUILD 0} %define mysql_vendor Sun Microsystems, Inc.
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x) %define mysql_version @VERSION@
# to build with yaSSL support (off by default)
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
%if %{STATIC_BUILD}
%define release 1
%else
%define release 1.glibc23
%endif
%define license GPL
%define mysqld_user mysql
%define mysqld_group mysql
%define server_suffix -community
%define mysqldatadir /var/lib/mysql
# We don't package all files installed into the build root by intention -
# See BUG#998 for details.
%define _unpackaged_files_terminate_build 0
%define mysqld_user mysql
%define mysqld_group mysql
%define mysqldatadir /var/lib/mysql
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com %define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
# ------------------------------------------------------------------------------
# On SuSE 9 no separate "debuginfo" package is built. To enable basic # On SuSE 9 no separate "debuginfo" package is built. To enable basic
# debugging on that platform, we don't strip binaries on SuSE 9. We # debugging on that platform, we don't strip binaries on SuSE 9. We
# disable the strip of binaries by redefining the RPM macro # disable the strip of binaries by redefining the RPM macro
...@@ -58,18 +45,68 @@ ...@@ -58,18 +45,68 @@
# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html # http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html # http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html # http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
# ------------------------------------------------------------------------------
%define __os_install_post /usr/lib/rpm/brp-compress %define __os_install_post /usr/lib/rpm/brp-compress
Name: MySQL # ------------------------------------------------------------------------------
# We don't package all files installed into the build root by intention -
# See BUG#998 for details.
# ------------------------------------------------------------------------------
%define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------
# RPM build tools now automatically detects Perl module dependencies. This
# detection gives problems as it is broken in some versions, and it also
# give unwanted dependencies from mandatory scripts in our package.
# Might not be possible to disable in all RPM tool versions, but here we
# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
# here might fail, and that package has the most problems.
# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
# ------------------------------------------------------------------------------
%undefine __perl_provides
%undefine __perl_requires
##############################################################################
# Command line handling
##############################################################################
# ----------------------------------------------------------------------
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# to build with yaSSL support (off by default)
# ----------------------------------------------------------------------
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
# ------------------------------------------------------------------------------
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x)
# to enable static linking (off by default)
%{?_with_static:%define STATIC_BUILD 1}
%{!?_with_static:%define STATIC_BUILD 0}
%if %{STATIC_BUILD}
%define release 1
%else
%define release 1.glibc23
%endif
%define license GPL
%define server_suffix -community
%define src_dir mysql-%{mysql_version}
##############################################################################
# Main spec file section
##############################################################################
Name: MySQL
Summary: MySQL: a very fast and reliable SQL database server Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases Group: Applications/Databases
Version: @MYSQL_U_SCORE_VERSION@ Version: @MYSQL_U_SCORE_VERSION@
Release: %{release} Release: %{release}
License: %{license} License: %{license}
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
URL: http://www.mysql.com/ URL: http://www.mysql.com/
Packager: MySQL Production Engineering Team <build@mysql.com> Packager: Sun Microsystems, Inc. Product Engineering Team <build@mysql.com>
Vendor: %{mysql_vendor} Vendor: %{mysql_vendor}
Provides: msqlormysql MySQL-server mysql Provides: msqlormysql MySQL-server mysql
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
...@@ -85,7 +122,7 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, ...@@ -85,7 +122,7 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB. Sun Microsystems, Inc.
Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software, This software comes with ABSOLUTELY NO WARRANTY. This is free software,
...@@ -95,6 +132,10 @@ The MySQL web site (http://www.mysql.com/) provides the latest ...@@ -95,6 +132,10 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the news and information about the MySQL software. Also please see the
documentation and the manual for more information. documentation and the manual for more information.
##############################################################################
# Sub package definition
##############################################################################
%package server %package server
Summary: MySQL: a very fast and reliable SQL database server Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases Group: Applications/Databases
...@@ -107,7 +148,7 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, ...@@ -107,7 +148,7 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of as for embedding into mass-deployed software. MySQL is a trademark of
MySQL AB. Sun Microsystems, Inc.
Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software, This software comes with ABSOLUTELY NO WARRANTY. This is free software,
...@@ -117,11 +158,14 @@ The MySQL web site (http://www.mysql.com/) provides the latest ...@@ -117,11 +158,14 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the news and information about the MySQL software. Also please see the
documentation and the manual for more information. documentation and the manual for more information.
This package includes the MySQL server binary (incl. InnoDB) as well This package includes the MySQL server binary
as related utilities to run and administrate a MySQL server. (configured including InnoDB)
as well as related utilities to run and administer a MySQL server.
If you want to access and work with the database, you have to install If you want to access and work with the database, you have to install
the package "MySQL-client" as well! package "MySQL-client" as well!
# ------------------------------------------------------------------------------
%package client %package client
Summary: MySQL - Client Summary: MySQL - Client
...@@ -134,6 +178,8 @@ This package contains the standard MySQL clients and administration tools. ...@@ -134,6 +178,8 @@ This package contains the standard MySQL clients and administration tools.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-storage %package ndb-storage
Summary: MySQL - ndbcluster storage engine Summary: MySQL - ndbcluster storage engine
Group: Applications/Databases Group: Applications/Databases
...@@ -145,6 +191,8 @@ computers that should store ndbcluster table data. ...@@ -145,6 +191,8 @@ computers that should store ndbcluster table data.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-management %package ndb-management
Summary: MySQL - ndbcluster storage engine management Summary: MySQL - ndbcluster storage engine management
Group: Applications/Databases Group: Applications/Databases
...@@ -156,6 +204,8 @@ one computer in the cluster. ...@@ -156,6 +204,8 @@ one computer in the cluster.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-tools %package ndb-tools
Summary: MySQL - ndbcluster storage engine basic tools Summary: MySQL - ndbcluster storage engine basic tools
Group: Applications/Databases Group: Applications/Databases
...@@ -165,6 +215,8 @@ This package contains ndbcluster storage engine basic tools. ...@@ -165,6 +215,8 @@ This package contains ndbcluster storage engine basic tools.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package ndb-extra %package ndb-extra
Summary: MySQL - ndbcluster storage engine extra tools Summary: MySQL - ndbcluster storage engine extra tools
Group: Applications/Databases Group: Applications/Databases
...@@ -175,6 +227,8 @@ They should be used with caution. ...@@ -175,6 +227,8 @@ They should be used with caution.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package bench %package bench
Requires: %{name}-client perl-DBI perl Requires: %{name}-client perl-DBI perl
Summary: MySQL - Benchmarks and test system Summary: MySQL - Benchmarks and test system
...@@ -188,6 +242,8 @@ This package contains MySQL benchmark scripts and data. ...@@ -188,6 +242,8 @@ This package contains MySQL benchmark scripts and data.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package devel %package devel
Summary: MySQL - Development header files and libraries Summary: MySQL - Development header files and libraries
Group: Applications/Databases Group: Applications/Databases
...@@ -200,6 +256,8 @@ necessary to develop MySQL client applications. ...@@ -200,6 +256,8 @@ necessary to develop MySQL client applications.
%{see_base} %{see_base}
# ------------------------------------------------------------------------------
%package shared %package shared
Summary: MySQL - Shared libraries Summary: MySQL - Shared libraries
Group: Applications/Databases Group: Applications/Databases
...@@ -230,7 +288,11 @@ languages and applications need to dynamically load and use MySQL. ...@@ -230,7 +288,11 @@ languages and applications need to dynamically load and use MySQL.
#%{see_base} #%{see_base}
%prep %prep
%setup -n mysql-%{mysql_version} %setup -n %{src_dir}
##############################################################################
# The actual build
##############################################################################
%build %build
...@@ -238,8 +300,8 @@ BuildMySQL() { ...@@ -238,8 +300,8 @@ BuildMySQL() {
# The --enable-assembler simply does nothing on systems that does not # The --enable-assembler simply does nothing on systems that does not
# support assembler speedups. # support assembler speedups.
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \ CC=\"${MYSQL_BUILD_CC:-$CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \ CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
CFLAGS=\"$CFLAGS\" \ CFLAGS=\"$CFLAGS\" \
CXXFLAGS=\"$CXXFLAGS\" \ CXXFLAGS=\"$CXXFLAGS\" \
LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \ LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \
...@@ -247,25 +309,25 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ ...@@ -247,25 +309,25 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
$* \ $* \
--enable-assembler \ --enable-assembler \
--enable-local-infile \ --enable-local-infile \
--with-mysqld-user=%{mysqld_user} \ --with-mysqld-user=%{mysqld_user} \
--with-unix-socket-path=/var/lib/mysql/mysql.sock \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \
--with-pic \ --with-pic \
--prefix=/ \ --prefix=/ \
%if %{YASSL_BUILD} %if %{YASSL_BUILD}
--with-yassl \ --with-yassl \
%endif %endif
--exec-prefix=%{_exec_prefix} \ --exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \ --libexecdir=%{_sbindir} \
--libdir=%{_libdir} \ --libdir=%{_libdir} \
--sysconfdir=%{_sysconfdir} \ --sysconfdir=%{_sysconfdir} \
--datadir=%{_datadir} \ --datadir=%{_datadir} \
--localstatedir=%{mysqldatadir} \ --localstatedir=%{mysqldatadir} \
--infodir=%{_infodir} \ --infodir=%{_infodir} \
--includedir=%{_includedir} \ --includedir=%{_includedir} \
--mandir=%{_mandir} \ --mandir=%{_mandir} \
--enable-thread-safe-client \ --enable-thread-safe-client \
--enable-community-features \ --enable-community-features \
--enable-profiling \ --enable-profiling \
--with-readline ; \ --with-readline ; \
# Add this for more debugging support # Add this for more debugging support
# --with-debug # --with-debug
...@@ -274,6 +336,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ ...@@ -274,6 +336,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
# benchdir does not fit in above model. Maybe a separate bench distribution # benchdir does not fit in above model. Maybe a separate bench distribution
make benchdir_root=$RPM_BUILD_ROOT/usr/share/ make benchdir_root=$RPM_BUILD_ROOT/usr/share/
} }
# end of function definition "BuildMySQL"
# Use our own copy of glibc # Use our own copy of glibc
...@@ -287,7 +350,7 @@ fi ...@@ -287,7 +350,7 @@ fi
# Use the build root for temporary storage of the shared libraries. # Use the build root for temporary storage of the shared libraries.
RBR=$RPM_BUILD_ROOT RBR=$RPM_BUILD_ROOT
MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} MBD=$RPM_BUILD_DIR/%{src_dir}
# Clean up the BuildRoot first # Clean up the BuildRoot first
[ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR; [ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR;
...@@ -301,10 +364,8 @@ export PATH ...@@ -301,10 +364,8 @@ export PATH
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and # Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code # including exceptions into the code
if [ -z "$CXX" -a -z "$CC" ] if [ -z "$CXX" -a -z "$CC" ] ; then
then export CC="gcc" CXX="gcc"
export CC="gcc"
export CXX="gcc"
fi fi
# Prepare compiler flags # Prepare compiler flags
...@@ -393,7 +454,7 @@ make test-bt ...@@ -393,7 +454,7 @@ make test-bt
%install %install
RBR=$RPM_BUILD_ROOT RBR=$RPM_BUILD_ROOT
MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} MBD=$RPM_BUILD_DIR/%{src_dir}
# Ensure that needed directories exists # Ensure that needed directories exists
install -d $RBR%{_sysconfdir}/{logrotate.d,init.d} install -d $RBR%{_sysconfdir}/{logrotate.d,init.d}
...@@ -417,7 +478,6 @@ install -s -m 755 $MBD/sql/mysqld-debug $RBR%{_sbindir}/mysqld-debug ...@@ -417,7 +478,6 @@ install -s -m 755 $MBD/sql/mysqld-debug $RBR%{_sbindir}/mysqld-debug
(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar) (cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar)
# install symbol files ( for stack trace resolution) # install symbol files ( for stack trace resolution)
# install -m 644 $MBD/sql/mysqld-max.sym $RBR%{_libdir}/mysql/mysqld-max.sym
install -m 644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym install -m 644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym
install -m 644 $MBD/sql/mysqld-debug.sym $RBR%{_libdir}/mysql/mysqld-debug.sym install -m 644 $MBD/sql/mysqld-debug.sym $RBR%{_libdir}/mysql/mysqld-debug.sym
...@@ -431,7 +491,7 @@ install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql ...@@ -431,7 +491,7 @@ install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
# Create a symlink "rcmysql", pointing to the init.script. SuSE users # Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this. # will appreciate that, as all services usually offer this.
ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql
# Create symbolic compatibility link safe_mysqld -> mysqld_safe # Create symbolic compatibility link safe_mysqld -> mysqld_safe
# (safe_mysqld will be gone in MySQL 4.1) # (safe_mysqld will be gone in MySQL 4.1)
...@@ -451,6 +511,7 @@ installed=`rpm -q --whatprovides mysql-server 2> /dev/null` ...@@ -451,6 +511,7 @@ installed=`rpm -q --whatprovides mysql-server 2> /dev/null`
if [ $? -eq 0 -a -n "$installed" ]; then if [ $? -eq 0 -a -n "$installed" ]; then
vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1`
version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1`
myoldvendor='%{mysql_old_vendor}'
myvendor='%{mysql_vendor}' myvendor='%{mysql_vendor}'
myversion='%{mysql_version}' myversion='%{mysql_version}'
...@@ -462,12 +523,12 @@ if [ $? -eq 0 -a -n "$installed" ]; then ...@@ -462,12 +523,12 @@ if [ $? -eq 0 -a -n "$installed" ]; then
[ -z "$new_family" ] && new_family="<bad package specification: version $myversion>" [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>"
error_text= error_text=
if [ "$vendor" != "$myvendor" ]; then if [ "$vendor" != "$myoldvendor" -a "$vendor" != "$myvendor" ]; then
error_text="$error_text error_text="$error_text
The current MySQL server package is provided by a different The current MySQL server package is provided by a different
vendor ($vendor) than $myvendor. Some files may be installed vendor ($vendor) than $myoldvendor or $myvendor.
to different locations, including log files and the service Some files may be installed to different locations, including log
startup script in %{_sysconfdir}/init.d/. files and the service startup script in %{_sysconfdir}/init.d/.
" "
fi fi
...@@ -511,58 +572,70 @@ HERE ...@@ -511,58 +572,70 @@ HERE
fi fi
# Shut down a previously installed server first # Shut down a previously installed server first
if test -x %{_sysconfdir}/init.d/mysql if [ -x %{_sysconfdir}/init.d/mysql ] ; then
then %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 echo "Giving mysqld 5 seconds to exit nicely"
echo "Giving mysqld a couple of seconds to exit nicely" sleep 5
sleep 5 elif [ -x %{_sysconfdir}/rc.d/init.d/mysql ] ; then
elif test -x %{_sysconfdir}/rc.d/init.d/mysql %{_sysconfdir}/rc.d/init.d/mysql stop > /dev/null 2>&1
then echo "Giving mysqld 5 seconds to exit nicely"
%{_sysconfdir}/rc.d/init.d/mysql stop > /dev/null 2>&1 sleep 5
echo "Giving mysqld a couple of seconds to exit nicely"
sleep 5
fi fi
%post server %post server
mysql_datadir=%{mysqldatadir} mysql_datadir=%{mysqldatadir}
# ----------------------------------------------------------------------
# Create data directory if needed # Create data directory if needed
if test ! -d $mysql_datadir; then mkdir -m 755 $mysql_datadir; fi # ----------------------------------------------------------------------
if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it. # Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
# use insserv for older SuSE Linux versions # use insserv for older SuSE Linux versions
if test -x /sbin/insserv if [ -x /sbin/insserv ] ; then
then
/sbin/insserv %{_sysconfdir}/init.d/mysql /sbin/insserv %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases # use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig elif [ -x /sbin/chkconfig ] ; then
then
/sbin/chkconfig --add mysql /sbin/chkconfig --add mysql
fi fi
# ----------------------------------------------------------------------
# Create a MySQL user and group. Do not report any problems if it already # Create a MySQL user and group. Do not report any problems if it already
# exists. # exists.
# ----------------------------------------------------------------------
groupadd -r %{mysqld_group} 2> /dev/null || true groupadd -r %{mysqld_group} 2> /dev/null || true
useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823) # The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# ----------------------------------------------------------------------
# Change permissions so that the user that will run the MySQL daemon # Change permissions so that the user that will run the MySQL daemon
# owns all database files. # owns all database files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Initiate databases if needed # Initiate databases if needed
# ----------------------------------------------------------------------
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet # Upgrade databases if needed would go here - but it cannot be automated yet
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Change permissions again to fix any new files. # Change permissions again to fix any new files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Fix permissions for the permission database so that only the user # Fix permissions for the permission database so that only the user
# can read them. # can read them.
# ----------------------------------------------------------------------
chmod -R og-rw $mysql_datadir/mysql chmod -R og-rw $mysql_datadir/mysql
# Restart in the same way that mysqld will be started normally. # Restart in the same way that mysqld will be started normally.
...@@ -578,33 +651,34 @@ mysql_clusterdir=/var/lib/mysql-cluster ...@@ -578,33 +651,34 @@ mysql_clusterdir=/var/lib/mysql-cluster
if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
%preun server %preun server
if test $1 = 0 if [ $1 = 0 ] ; then
then # Stop MySQL before uninstalling it
# Stop MySQL before uninstalling it if [ -x %{_sysconfdir}/init.d/mysql ] ; then
if test -x %{_sysconfdir}/init.d/mysql %{_sysconfdir}/init.d/mysql stop > /dev/null
then # Remove autostart of MySQL
%{_sysconfdir}/init.d/mysql stop > /dev/null # For older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
# Remove autostart of mysql /sbin/insserv -r %{_sysconfdir}/init.d/mysql
# for older SuSE Linux versions # use chkconfig on Red Hat and newer SuSE releases
if test -x /sbin/insserv elif [ -x /sbin/chkconfig ] ; then
then /sbin/chkconfig --del mysql
/sbin/insserv -r %{_sysconfdir}/init.d/mysql fi
# use chkconfig on Red Hat and newer SuSE releases fi
elif test -x /sbin/chkconfig
then
/sbin/chkconfig --del mysql
fi
fi
fi fi
# We do not remove the mysql user since it may still own a lot of # We do not remove the mysql user since it may still own a lot of
# database files. # database files.
# Clean up the BuildRoot # ----------------------------------------------------------------------
# Clean up the BuildRoot after build is done
# ----------------------------------------------------------------------
%clean %clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
##############################################################################
# Files section
##############################################################################
%files server %files server
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
...@@ -818,6 +892,19 @@ fi ...@@ -818,6 +892,19 @@ fi
# itself - note that they must be ordered by date (important when # itself - note that they must be ordered by date (important when
# merging BK trees) # merging BK trees)
%changelog %changelog
* Mon Feb 01 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Formatting changes:
Have a consistent structure of separator lines and of indentation
(8 leading blanks => tab).
- Add the "old vendor" (= "MySQL AB") and expand the upgrade check
so that "MySQL" packages can be upgraded by "Sun" ones.
This fixes bug#45534, with its duplicates #42953 and #46174.
- Backport the fix that prevents RPM from requiring "perl-DBI".
- Introduce the variable "src_dir".
- Give the environment variables "MYSQL_BUILD_CC(CXX)" precedence
over "CC" ("CXX").
* Mon Jan 11 2010 Joerg Bruehe <joerg.bruehe@sun.com> * Mon Jan 11 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Change RPM file naming: - Change RPM file naming:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment