Skip to content

Commit

Permalink
Added sles11 repo packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bkandasa authored and kevincrane committed Feb 10, 2015
1 parent 2e620b4 commit 28dbc5f
Show file tree
Hide file tree
Showing 11 changed files with 2,099 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -413,6 +413,7 @@ IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(internal)
ENDIF()
ADD_SUBDIRECTORY(packaging/rpm-oel)
ADD_SUBDIRECTORY(packaging/rpm-sles)
ENDIF()

INCLUDE(cmake/abi_check.cmake)
Expand Down
28 changes: 28 additions & 0 deletions packaging/rpm-sles/CMakeLists.txt
@@ -0,0 +1,28 @@
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(SPECFILENAME "mysql.spec")
# Left in current directory, to be taken during build
CONFIGURE_FILE(mysql.spec.in ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY)
FOREACH(fedfile my.cnf my_config.h mysql.init
mysqld.service mysql-systemd-start mysql.conf
filter-requires.sh filter-provides.sh)
CONFIGURE_FILE(${fedfile} ${CMAKE_CURRENT_BINARY_DIR}/${fedfile} COPYONLY)
ENDFOREACH()
ENDIF()

6 changes: 6 additions & 0 deletions packaging/rpm-sles/filter-provides.sh
@@ -0,0 +1,6 @@
#! /bin/bash
#

/usr/lib/rpm/perl.prov $* |
sed -e '/perl(hostnames)/d' -e '/perl(lib::mtr.*/d' -e '/perl(lib::v1.*/d' -e '/perl(mtr_.*/d' -e '/perl(My::.*/d'

6 changes: 6 additions & 0 deletions packaging/rpm-sles/filter-requires.sh
@@ -0,0 +1,6 @@
#! /bin/bash
#

/usr/lib/rpm/perl.req $* |
sed -e '/perl(GD)/d' -e '/perl(hostnames)/d' -e '/perl(lib::mtr.*/d' -e '/perl(lib::v1.*/d' -e '/perl(mtr_.*/d' -e '/perl(My::.*/d'

31 changes: 31 additions & 0 deletions packaging/rpm-sles/my.cnf
@@ -0,0 +1,31 @@
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.5/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysql/mysqld.log
pid-file=/var/run/mysql/mysqld.pid
30 changes: 30 additions & 0 deletions packaging/rpm-sles/my_config.h
@@ -0,0 +1,30 @@
/*
* Fedora supports multi arch: having 32 and 64 versions of MySQL
* installed at the same time. my_config.h will differ due arch
* dependent defs creating a file conflict. We move arch specific
* headers to arch specific file names and include the correct arch
* specific file by installing this generic file.
*
*/

#if defined(__i386__)
#include "my_config_i386.h"
#elif defined(__ia64__)
#include "my_config_ia64.h"
#elif defined(__powerpc__)
#include "my_config_ppc.h"
#elif defined(__powerpc64__)
#include "my_config_ppc64.h"
#elif defined(__s390x__)
#include "my_config_s390x.h"
#elif defined(__s390__)
#include "my_config_s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "my_config_sparc64.h"
#elif defined(__sparc__)
#include "my_config_sparc.h"
#elif defined(__x86_64__)
#include "my_config_x86_64.h"
#else
#error "This MySQL devel package does not work your architecture?"
#endif
66 changes: 66 additions & 0 deletions packaging/rpm-sles/mysql-systemd-start
@@ -0,0 +1,66 @@
#! /bin/bash
#
# Scripts to run by MySQL systemd service
#
# Needed argument: pre | post
#
# pre mode : try to run mysql_install_db and fix perms and SELinux contexts
# post mode : ping server until answer is received
#

install_db () {
# Note: something different than datadir=/var/lib/mysql requires SELinux policy changes (in enforcing mode)
datadir=$(/usr/bin/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p')

# Restore log, dir, perms and SELinux contexts
[ -d "$datadir" ] || install -d -m 0755 -omysql -gmysql "$datadir" || exit 1
log=/var/log/mysqld.log
[ -e $log ] || touch $log
chmod 0640 $log
chown mysql:mysql $log || exit 1
if [ -x /usr/sbin/restorecon ]; then
/usr/sbin/restorecon "$datadir"
/usr/sbin/restorecon $log
fi

# If special mysql dir is in place, skip db install
[ -d "$datadir/mysql" ] && exit 0

# Create initial db
/usr/bin/mysql_install_db --rpm --datadir="$datadir" --user=mysql

# Create a file to trigger execution of mysql_secure_installation
# after server has started
touch "$datadir"/.phase_two_required

exit 0
}

pinger () {
# Wait for ping to answer to signal startup completed,
# might take a while in case of e.g. crash recovery
# MySQL systemd service will timeout script if no answer
ret=1
while /bin/true ; do
sleep 1
mysqladmin ping >/dev/null 2>&1 && ret=0 && break
done

# If server has been started successfully and file created in
# install_db step is present we run mysql_secure_installation
if [ $ret -eq 0 -a -e "$datadir"/.phase_two_required -a -x /usr/bin/mysql_secure_installation ] ; then
/usr/bin/mysql_secure_installation --use-default --defaults-file=/etc/my.cnf
rm -f "$datadir"/.phase_two_required
fi

exit 0
}

# main
case $1 in
"pre") install_db ;;
"post") pinger ;;
esac

exit 0

1 change: 1 addition & 0 deletions packaging/rpm-sles/mysql.conf
@@ -0,0 +1 @@
d /var/run/mysqld 0755 mysql mysql -

0 comments on commit 28dbc5f

Please sign in to comment.