21 changed files with 369 additions and 109 deletions
-
3.bzrignore
-
74CMakeLists.txt
-
2client/CMakeLists.txt
-
88cmake/cpack_rpm.cmake
-
30cmake/install_layout.cmake
-
6cmake/mysql_version.cmake
-
4extra/CMakeLists.txt
-
2include/CMakeLists.txt
-
4libmysqld/CMakeLists.txt
-
2libmysqld/examples/CMakeLists.txt
-
48man/CMakeLists.txt
-
2plugin/auth_dialog/CMakeLists.txt
-
4scripts/CMakeLists.txt
-
6sql/CMakeLists.txt
-
10storage/maria/CMakeLists.txt
-
8storage/myisam/CMakeLists.txt
-
20support-files/CMakeLists.txt
-
1support-files/rpm-ldconfig.sh
-
77support-files/rpm-postin.sh
-
73support-files/rpm-prein.sh
-
14support-files/rpm-preun.sh
@ -0,0 +1,88 @@ |
|||
IF(RPM) |
|||
|
|||
SET(CPACK_GENERATOR "RPM") |
|||
SET(CPACK_RPM_PACKAGE_DEBUG 1) |
|||
SET(INSTALL_LAYOUT "RPM") |
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7) |
|||
|
|||
SET(CPACK_RPM_COMPONENT_INSTALL ON) |
|||
|
|||
SET(CPACK_COMPONENT_SERVER_GROUP "server") |
|||
SET(CPACK_COMPONENT_MANPAGESSERVER_GROUP "server") |
|||
SET(CPACK_COMPONENT_INIFILES_GROUP "server") |
|||
SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "server") |
|||
SET(CPACK_COMPONENT_SUPPORTFILES_GROUP "server") |
|||
SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "devel") |
|||
SET(CPACK_COMPONENT_MANPAGESDEVELOPMENT_GROUP "devel") |
|||
SET(CPACK_COMPONENT_TEST_GROUP "test") |
|||
SET(CPACK_COMPONENT_MANPAGESTEST_GROUP "test") |
|||
SET(CPACK_COMPONENT_CLIENT_GROUP "client") |
|||
SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client") |
|||
SET(CPACK_COMPONENT_README_GROUP "server") |
|||
SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") |
|||
SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts |
|||
SupportFiles Development ManPagesDevelopment |
|||
Test ManPagesTest Readme ManPagesClient |
|||
Client SharedLibraries) |
|||
|
|||
SET(CPACK_RPM_PACKAGE_NAME "MariaDB") |
|||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") |
|||
|
|||
SET(CPACK_RPM_PACKAGE_RELEASE 1) # FIX: add distribution name here |
|||
SET(CPACK_RPM_PACKAGE_LICENSE "GPL") |
|||
SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) |
|||
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") |
|||
SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") |
|||
SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server") |
|||
SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} |
|||
|
|||
It is GPL v2 licensed, which means you can use the it free of charge under the |
|||
conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/). |
|||
|
|||
MariaDB documentation can be found at http://kb.askmonty.org/ |
|||
MariaDB bug reports should be submitted through https://mariadb.atlassian.net/ |
|||
|
|||
") |
|||
|
|||
SET(CPACK_RPM_SPEC_MORE_DEFINE " |
|||
%define mysql_vendor ${CPACK_PACKAGE_VENDOR} |
|||
%define mysqlversion ${MYSQL_NO_DASH_VERSION} |
|||
%define mysqldatadir /var/lib/mysql |
|||
%define mysqld_user mysql |
|||
%define mysqld_group mysql |
|||
") |
|||
|
|||
# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html |
|||
# both /etc and /etc/init.d should be ignored as of 2.8.7 |
|||
# only /etc/init.d as of 2.8.8 |
|||
# and eventually this hack should go away completely |
|||
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} |
|||
%define ignore \# |
|||
") |
|||
set(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d") |
|||
|
|||
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MariaDB-client MySQL-client MySQL-OurDelta-client") |
|||
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client") |
|||
|
|||
SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MariaDB-devel MySQL-devel MySQL-OurDelta-devel") |
|||
SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel") |
|||
|
|||
SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MariaDB-server MySQL-server MySQL-OurDelta-server") |
|||
SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server") |
|||
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-prein.sh) |
|||
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-preun.sh) |
|||
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-postin.sh) |
|||
|
|||
SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MariaDB-shared MySQL-shared MySQL-OurDelta-shared") |
|||
SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared mysql-libs libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION}) libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION})") |
|||
SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-ldconfig.sh) |
|||
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-ldconfig.sh) |
|||
|
|||
SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MariaDB-test MySQL-test MySQL-OurDelta-test") |
|||
SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test") |
|||
|
|||
# workaround for lots of perl dependencies added by rpmbuild |
|||
SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_misc.pl)") |
|||
|
|||
ENDIF(RPM) |
|||
|
@ -0,0 +1 @@ |
|||
/sbin/ldconfig |
@ -0,0 +1,77 @@ |
|||
mysql_datadir=%{mysqldatadir} |
|||
|
|||
# Create data directory |
|||
mkdir -p $mysql_datadir/{mysql,test} |
|||
|
|||
# Make MySQL start/shutdown automatically when the machine does it. |
|||
if [ -x /sbin/chkconfig ] ; then |
|||
/sbin/chkconfig --add mysql |
|||
fi |
|||
|
|||
# Create a MySQL user and group. Do not report any problems if it already |
|||
# exists. |
|||
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 |
|||
# 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 |
|||
|
|||
# Change permissions so that the user that will run the MySQL daemon |
|||
# owns all database files. |
|||
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir |
|||
|
|||
# Initiate databases |
|||
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} |
|||
|
|||
# Upgrade databases if needed would go here - but it cannot be automated yet |
|||
|
|||
# Change permissions again to fix any new files. |
|||
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir |
|||
|
|||
# Fix permissions for the permission database so that only the user |
|||
# can read them. |
|||
chmod -R og-rw $mysql_datadir/mysql |
|||
|
|||
# install SELinux files - but don't override existing ones |
|||
SETARGETDIR=/etc/selinux/targeted/src/policy |
|||
SEDOMPROG=$SETARGETDIR/domains/program |
|||
SECONPROG=$SETARGETDIR/file_contexts/program |
|||
if [ -f /etc/redhat-release ] \ |
|||
&& grep -q "Red Hat Enterprise Linux .. release 4" /etc/redhat-release \ |
|||
|| grep -q "CentOS release 4" /etc/redhat-release ; then |
|||
echo |
|||
echo |
|||
echo 'Notes regarding SELinux on this platform:' |
|||
echo '=========================================' |
|||
echo |
|||
echo 'The default policy might cause server startup to fail because it is ' |
|||
echo 'not allowed to access critical files. In this case, please update ' |
|||
echo 'your installation. ' |
|||
echo |
|||
echo 'The default policy might also cause inavailability of SSL related ' |
|||
echo 'features because the server is not allowed to access /dev/random ' |
|||
echo 'and /dev/urandom. If this is a problem, please do the following: ' |
|||
echo |
|||
echo ' 1) install selinux-policy-targeted-sources from your OS vendor' |
|||
echo ' 2) add the following two lines to '$SEDOMPROG/mysqld.te':' |
|||
echo ' allow mysqld_t random_device_t:chr_file read;' |
|||
echo ' allow mysqld_t urandom_device_t:chr_file read;' |
|||
echo ' 3) cd to '$SETARGETDIR' and issue the following command:' |
|||
echo ' make load' |
|||
echo |
|||
echo |
|||
fi |
|||
|
|||
if [ -x sbin/restorecon ] ; then |
|||
sbin/restorecon -R var/lib/mysql |
|||
fi |
|||
|
|||
# Restart in the same way that mysqld will be started normally. |
|||
if [ -x %{_sysconfdir}/init.d/mysql ] ; then |
|||
%{_sysconfdir}/init.d/mysql start |
|||
echo "Giving mysqld 2 seconds to start" |
|||
sleep 2 |
|||
fi |
|||
|
|||
# Allow safe_mysqld to start mysqld and print a message before we exit |
|||
sleep 2 |
|||
|
@ -0,0 +1,73 @@ |
|||
# Check if we can safely upgrade. An upgrade is only safe if it's from one |
|||
# of our RPMs in the same version family. |
|||
|
|||
installed=`rpm -q --whatprovides mysql-server 2> /dev/null` |
|||
if [ $? -eq 0 -a -n "$installed" ]; then |
|||
vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` |
|||
version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` |
|||
myvendor='%{mysql_vendor}' |
|||
myversion='%{mysqlversion}' |
|||
|
|||
old_family=`echo $version | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` |
|||
new_family=`echo $myversion | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` |
|||
|
|||
[ -z "$vendor" ] && vendor='<unknown>' |
|||
[ -z "$old_family" ] && old_family="<unrecognized version $version>" |
|||
[ -z "$new_family" ] && new_family="<bad package specification: version $myversion>" |
|||
|
|||
error_text= |
|||
if [ "$vendor" != "$myvendor" ]; then |
|||
error_text="$error_text |
|||
The current MariaDB server package is provided by a different |
|||
vendor ($vendor) than $myvendor. Some files may be installed |
|||
to different locations, including log files and the service |
|||
startup script in %{_sysconfdir}/init.d/. |
|||
" |
|||
fi |
|||
|
|||
if [ "$old_family" != "$new_family" ]; then |
|||
error_text="$error_text |
|||
Upgrading directly from MySQL $old_family to MariaDB $new_family may not |
|||
be safe in all cases. A manual dump and restore using mysqldump is |
|||
recommended. It is important to review the MariaDB manual's Upgrading |
|||
section for version-specific incompatibilities. |
|||
" |
|||
fi |
|||
|
|||
if [ -n "$error_text" ]; then |
|||
cat <<HERE >&2 |
|||
|
|||
****************************************************************** |
|||
A MySQL or MariaDB server package ($installed) is installed. |
|||
$error_text |
|||
A manual upgrade is required. |
|||
|
|||
- Ensure that you have a complete, working backup of your data and my.cnf |
|||
files |
|||
- Shut down the MySQL server cleanly |
|||
- Remove the existing MySQL packages. Usually this command will |
|||
list the packages you should remove: |
|||
rpm -qa | grep -i '^mysql-' |
|||
|
|||
You may choose to use 'rpm --nodeps -ev <package-name>' to remove |
|||
the package which contains the mysqlclient shared library. The |
|||
library will be reinstalled by the MariaDB-shared package. |
|||
- Install the new MariaDB packages supplied by $myvendor |
|||
- Ensure that the MariaDB server is started |
|||
- Run the 'mysql_upgrade' program |
|||
|
|||
This is a brief description of the upgrade process. Important details |
|||
can be found in the MariaDB manual, in the Upgrading section. |
|||
****************************************************************** |
|||
HERE |
|||
exit 1 |
|||
fi |
|||
fi |
|||
|
|||
# Shut down a previously installed server first |
|||
if [ -x %{_sysconfdir}/init.d/mysql ] ; then |
|||
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 |
|||
echo "Giving mysqld 5 seconds to exit nicely" |
|||
sleep 5 |
|||
fi |
|||
|
@ -0,0 +1,14 @@ |
|||
if [ $1 = 0 ] ; then |
|||
# Stop MySQL before uninstalling it |
|||
if [ -x %{_sysconfdir}/init.d/mysql ] ; then |
|||
%{_sysconfdir}/init.d/mysql stop > /dev/null |
|||
# Don't start it automatically anymore |
|||
if [ -x /sbin/chkconfig ] ; then |
|||
/sbin/chkconfig --del mysql |
|||
fi |
|||
fi |
|||
fi |
|||
|
|||
# We do not remove the mysql user since it may still own a lot of |
|||
# database files. |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue