diff --git a/mariadb-check-socket b/mariadb-check-socket deleted file mode 100644 index 955dc4f..0000000 --- a/mariadb-check-socket +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# We check if there is already a process using the socket file, -# since otherwise the systemd service file could report false -# positive result when starting and mysqld_safe could remove -# a socket file, which is actually being used by a different daemon. - -source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" - -if test -e "$socketfile" ; then - echo "Socket file $socketfile exists." >&2 - - # no write permissions - if ! test -w "$socketfile" ; then - echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2 - echo "Please, remove $socketfile manually to start the service." >&2 - exit 1 - fi - - # not a socket file - if ! test -S "$socketfile" ; then - echo "The file $socketfile is not a socket file, which is suspicious." >&2 - echo "Please, remove $socketfile manually to start the service." >&2 - exit 1 - fi - - # some process uses the socket file - if fuser "$socketfile" &>/dev/null ; then - socketpid=$(fuser "$socketfile" 2>/dev/null) - echo "Is another MySQL daemon already running with the same unix socket?" >&2 - echo "Please, stop the process $socketpid or remove $socketfile manually to start the service." >&2 - exit 1 - fi - - # socket file is a garbage - echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2 -fi - -exit 0 diff --git a/mariadb-check-socket.sh b/mariadb-check-socket.sh new file mode 100644 index 0000000..955dc4f --- /dev/null +++ b/mariadb-check-socket.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# We check if there is already a process using the socket file, +# since otherwise the systemd service file could report false +# positive result when starting and mysqld_safe could remove +# a socket file, which is actually being used by a different daemon. + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +if test -e "$socketfile" ; then + echo "Socket file $socketfile exists." >&2 + + # no write permissions + if ! test -w "$socketfile" ; then + echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # not a socket file + if ! test -S "$socketfile" ; then + echo "The file $socketfile is not a socket file, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # some process uses the socket file + if fuser "$socketfile" &>/dev/null ; then + socketpid=$(fuser "$socketfile" 2>/dev/null) + echo "Is another MySQL daemon already running with the same unix socket?" >&2 + echo "Please, stop the process $socketpid or remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # socket file is a garbage + echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2 +fi + +exit 0 diff --git a/mariadb-prepare-db-dir b/mariadb-prepare-db-dir deleted file mode 100644 index 3b464e9..0000000 --- a/mariadb-prepare-db-dir +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -# This script creates the mysql data directory during first service start. -# In subsequent starts, it does nothing much. - -source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" - -# Absorb configuration settings from the specified systemd service file, -# or the default "mariadb" service if not specified -SERVICE_NAME="$1" -if [ x"$SERVICE_NAME" = x ] -then - SERVICE_NAME=mariadb.service -fi - -myuser=`systemctl show -p User "${SERVICE_NAME}" | - sed 's/^User=//'` -if [ x"$myuser" = x ] -then - myuser=mysql -fi - -mygroup=`systemctl show -p Group "${SERVICE_NAME}" | - sed 's/^Group=//'` -if [ x"$mygroup" = x ] -then - mygroup=mysql -fi - -# Set up the errlogfile with appropriate permissions -touch "$errlogfile" -ret=$? -# Provide some advice if the log file cannot be touched -if [ $ret -ne 0 ] ; then - errlogdir=$(dirname $errlogfile) - if ! [ -d "$errlogdir" ] ; then - echo "The directory $errlogdir does not exist." - elif [ -f "$errlogfile" ] ; then - echo "The log file $errlogfile cannot be touched, please, fix its permissions." - else - echo "The log file $errlogfile could not be created." - fi - echo "The daemon will be run under $myuser:$mygroup" - exit 1 -fi -chown "$myuser:$mygroup" "$errlogfile" -chmod 0640 "$errlogfile" -[ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile" - -# Make the data directory -if [ ! -d "$datadir/mysql" ] ; then - # First, make sure $datadir is there with correct permissions - # (note: if it's not, and we're not root, this'll fail ...) - if [ ! -e "$datadir" -a ! -h "$datadir" ] - then - mkdir -p "$datadir" || exit 1 - fi - chown "$myuser:$mygroup" "$datadir" - chmod 0755 "$datadir" - [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" - - # Now create the database - echo "Initializing MySQL database" - /usr/bin/mysql_install_db --datadir="$datadir" --user="$myuser" - ret=$? - if [ $ret -ne 0 ] ; then - echo "Initialization of MySQL database failed." >&2 - echo "Perhaps /etc/my.cnf is misconfigured." >&2 - # Clean up any partially-created database files - if [ ! -e "$datadir/mysql/user.frm" ] ; then - rm -rf "$datadir"/* - fi - exit $ret - fi - # In case we're running as root, make sure files are owned properly - chown -R "$myuser:$mygroup" "$datadir" -fi - -exit 0 diff --git a/mariadb-prepare-db-dir.sh b/mariadb-prepare-db-dir.sh new file mode 100644 index 0000000..0e574bc --- /dev/null +++ b/mariadb-prepare-db-dir.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +# This script creates the mysql data directory during first service start. +# In subsequent starts, it does nothing much. + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +# Absorb configuration settings from the specified systemd service file, +# or the default "mariadb" service if not specified +SERVICE_NAME="$1" +if [ x"$SERVICE_NAME" = x ] +then + SERVICE_NAME=@RPM_PACKAGE_PREFIX@mariadb.service +fi + +myuser=`systemctl show -p User "${SERVICE_NAME}" | + sed 's/^User=//'` +if [ x"$myuser" = x ] +then + myuser=mysql +fi + +mygroup=`systemctl show -p Group "${SERVICE_NAME}" | + sed 's/^Group=//'` +if [ x"$mygroup" = x ] +then + mygroup=mysql +fi + +# Set up the errlogfile with appropriate permissions +touch "$errlogfile" +ret=$? +# Provide some advice if the log file cannot be touched +if [ $ret -ne 0 ] ; then + errlogdir=$(dirname $errlogfile) + if ! [ -d "$errlogdir" ] ; then + echo "The directory $errlogdir does not exist." + elif [ -f "$errlogfile" ] ; then + echo "The log file $errlogfile cannot be touched, please, fix its permissions." + else + echo "The log file $errlogfile could not be created." + fi + echo "The daemon will be run under $myuser:$mygroup" + exit 1 +fi +chown "$myuser:$mygroup" "$errlogfile" +chmod 0640 "$errlogfile" +[ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile" + +# Make the data directory +if [ ! -d "$datadir/mysql" ] ; then + # First, make sure $datadir is there with correct permissions + # (note: if it's not, and we're not root, this'll fail ...) + if [ ! -e "$datadir" -a ! -h "$datadir" ] + then + mkdir -p "$datadir" || exit 1 + fi + chown "$myuser:$mygroup" "$datadir" + chmod 0755 "$datadir" + [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" + + # Now create the database + echo "Initializing MySQL database" + @bindir@/mysql_install_db --datadir="$datadir" --user="$myuser" + ret=$? + if [ $ret -ne 0 ] ; then + echo "Initialization of MySQL database failed." >&2 + echo "Perhaps @sysconfdir@/my.cnf is misconfigured." >&2 + # Clean up any partially-created database files + if [ ! -e "$datadir/mysql/user.frm" ] ; then + rm -rf "$datadir"/* + fi + exit $ret + fi + # In case we're running as root, make sure files are owned properly + chown -R "$myuser:$mygroup" "$datadir" +fi + +exit 0 diff --git a/mariadb-scripts-common b/mariadb-scripts-common deleted file mode 100755 index 7278350..0000000 --- a/mariadb-scripts-common +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -# Some useful functions used in other MySQL helper scripts -# This scripts defines variables datadir, errlogfile, socketfile - -export LC_ALL=C - -# extract value of a MySQL option from config files -# Usage: get_mysql_option VARNAME DEFAULT SECTION [ SECTION, ... ] -# result is returned in $result -# We use my_print_defaults which prints all options from multiple files, -# with the more specific ones later; hence take the last match. -get_mysql_option(){ - if [ $# -ne 3 ] ; then - echo "get_mysql_option requires 3 arguments: section option default_value" - return - fi - sections="$1" - option_name="$2" - default_value="$3" - result=`/usr/bin/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` - if [ -z "$result" ]; then - # not found, use default - result="${default_value}" - fi -} - -# Defaults here had better match what mysqld_safe will default to -# The option values are generally defined on three important places -# on the default installation: -# 1) default values are hardcoded in the code of mysqld daemon or -# mysqld_safe script -# 2) configurable values are defined in /etc/my.cnf -# 3) default values for helper scripts are specified bellow -# So, in case values are defined in my.cnf, we need to get that value. -# In case they are not defined in my.cnf, we need to get the same value -# in the daemon, as in the helper scripts. Thus, default values here -# must correspond with values defined in mysqld_safe script and source -# code itself. - -server_sections="mysqld_safe mysqld server mariadb" - -get_mysql_option "$server_sections" datadir "/var/lib/mysql" -datadir="$result" - -# if there is log_error in the my.cnf, my_print_defaults still -# returns log-error -# log-error might be defined in mysqld_safe and mysqld sections, -# the former has bigger priority -get_mysql_option "$server_sections" log-error "`hostname`.err" -errlogfile="$result" - -get_mysql_option "$server_sections" socket "/var/lib/mysql/mysql.sock" -socketfile="$result" - -get_mysql_option "$server_sections" pid-file "`hostname`.pid" -pidfile="$result" - diff --git a/mariadb-scripts-common.sh b/mariadb-scripts-common.sh new file mode 100755 index 0000000..7ce9a11 --- /dev/null +++ b/mariadb-scripts-common.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# Some useful functions used in other MySQL helper scripts +# This scripts defines variables datadir, errlogfile, socketfile + +export LC_ALL=C + +# extract value of a MySQL option from config files +# Usage: get_mysql_option VARNAME DEFAULT SECTION [ SECTION, ... ] +# result is returned in $result +# We use my_print_defaults which prints all options from multiple files, +# with the more specific ones later; hence take the last match. +get_mysql_option(){ + if [ $# -ne 3 ] ; then + echo "get_mysql_option requires 3 arguments: section option default_value" + return + fi + sections="$1" + option_name="$2" + default_value="$3" + result=`/usr/bin/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1` + if [ -z "$result" ]; then + # not found, use default + result="${default_value}" + fi +} + +# Defaults here had better match what mysqld_safe will default to +# The option values are generally defined on three important places +# on the default installation: +# 1) default values are hardcoded in the code of mysqld daemon or +# mysqld_safe script +# 2) configurable values are defined in /etc/my.cnf +# 3) default values for helper scripts are specified bellow +# So, in case values are defined in my.cnf, we need to get that value. +# In case they are not defined in my.cnf, we need to get the same value +# in the daemon, as in the helper scripts. Thus, default values here +# must correspond with values defined in mysqld_safe script and source +# code itself. + +server_sections="mysqld_safe mysqld server mysqld-@MAJOR_VERSION@.@MINOR_VERSION@ mariadb mariadb-@MAJOR_VERSION@.@MINOR_VERSION@ client-server" + +get_mysql_option "$server_sections" datadir "@MYSQL_DATADIR@" +datadir="$result" + +# if there is log_error in the my.cnf, my_print_defaults still +# returns log-error +# log-error might be defined in mysqld_safe and mysqld sections, +# the former has bigger priority +get_mysql_option "$server_sections" log-error "`hostname`.err" +errlogfile="$result" + +get_mysql_option "$server_sections" socket "@MYSQL_UNIX_ADDR@" +socketfile="$result" + +get_mysql_option "$server_sections" pid-file "`hostname`.pid" +pidfile="$result" + diff --git a/mariadb-wait-ready b/mariadb-wait-ready deleted file mode 100644 index ad1392b..0000000 --- a/mariadb-wait-ready +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" - -# This script waits for mysqld to be ready to accept connections -# (which can be many seconds or even minutes after launch, if there's -# a lot of crash-recovery work to do). -# Running this as ExecStartPost is useful so that services declared as -# "After mysqld" won't be started until the database is really ready. - -if [ $# -ne 1 ] ; then - echo "You need to pass daemon pid as an argument for this script." - exit 20 -fi - -# Service file passes us the daemon's PID (actually, mysqld_safe's PID) -daemon_pid="$1" - -# Wait for the server to come up or for the mysqld process to disappear -ret=0 -while /bin/true; do - # Check process still exists - if ! [ -d "/proc/${daemon_pid}" ] ; then - ret=1 - break - fi - RESPONSE=`/usr/bin/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` - mret=$? - if [ $mret -eq 0 ] ; then - break - fi - # exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected, - # anything else suggests a configuration error - if [ $mret -ne 1 -a $mret -ne 11 ]; then - ret=$mret - break - fi - # "Access denied" also means the server is alive - echo "$RESPONSE" | grep -q "Access denied for user" && break - - sleep 1 -done - -exit $ret diff --git a/mariadb-wait-ready.sh b/mariadb-wait-ready.sh new file mode 100644 index 0000000..cf5409f --- /dev/null +++ b/mariadb-wait-ready.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" + +# This script waits for mysqld to be ready to accept connections +# (which can be many seconds or even minutes after launch, if there's +# a lot of crash-recovery work to do). +# Running this as ExecStartPost is useful so that services declared as +# "After mysqld" won't be started until the database is really ready. + +if [ $# -ne 1 ] ; then + echo "You need to pass daemon pid as an argument for this script." + exit 20 +fi + +# Service file passes us the daemon's PID (actually, mysqld_safe's PID) +daemon_pid="$1" + +# Wait for the server to come up or for the mysqld process to disappear +ret=0 +while /bin/true; do + # Check process still exists + if ! [ -d "/proc/${daemon_pid}" ] ; then + ret=1 + break + fi + RESPONSE=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` + mret=$? + if [ $mret -eq 0 ] ; then + break + fi + # exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected, + # anything else suggests a configuration error + if [ $mret -ne 1 -a $mret -ne 11 ]; then + ret=$mret + break + fi + # "Access denied" also means the server is alive + echo "$RESPONSE" | grep -q "Access denied for user" && break + + sleep 1 +done + +exit $ret diff --git a/mariadb.service b/mariadb.service deleted file mode 100644 index f938b05..0000000 --- a/mariadb.service +++ /dev/null @@ -1,51 +0,0 @@ -# It's not recommended to modify this file in-place, because it will be -# overwritten during package upgrades. If you want to customize, the -# best way is to create a file "/etc/systemd/system/mariadb.service", -# containing -# .include /lib/systemd/system/mariadb.service -# ...make your changes here... -# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf", -# which doesn't need to include ".include" call and which will be parsed -# after the file mariadb.service itself is parsed. -# -# For more info about custom unit files, see systemd.unit(5) or -# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F - -# For example, if you want to increase mysql's open-files-limit to 10000, -# you need to increase systemd's LimitNOFILE setting, so create a file named -# "/etc/systemd/system/mariadb.service.d/limits.conf" containing: -# [Service] -# LimitNOFILE=10000 - -# Note: /usr/lib/... is recommended in the .include line though /lib/... -# still works. -# Don't forget to reload systemd daemon after you change unit configuration: -# root> systemctl --system daemon-reload - -[Unit] -Description=MariaDB database server -After=syslog.target -After=network.target -BindsTo=mysqld.service - -[Service] -Type=simple -User=mysql -Group=mysql - -ExecStartPre=/usr/libexec/mariadb-check-socket -ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n -# Note: we set --basedir to prevent probes that might trigger SELinux alarms, -# per bug #547485 -ExecStart=/usr/bin/mysqld_safe --basedir=/usr -ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID - -# Give a reasonable amount of time for the server to start up/shut down -TimeoutSec=300 - -# Place temp files in a secure directory, not /tmp -PrivateTmp=true - -[Install] -WantedBy=multi-user.target -Also=mysqld.service diff --git a/mariadb.service.in b/mariadb.service.in new file mode 100644 index 0000000..82b87db --- /dev/null +++ b/mariadb.service.in @@ -0,0 +1,51 @@ +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the +# best way is to create a file "/etc/systemd/system/mariadb.service", +# containing +# .include /lib/systemd/system/mariadb.service +# ...make your changes here... +# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf", +# which doesn't need to include ".include" call and which will be parsed +# after the file mariadb.service itself is parsed. +# +# For more info about custom unit files, see systemd.unit(5) or +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F + +# For example, if you want to increase mysql's open-files-limit to 10000, +# you need to increase systemd's LimitNOFILE setting, so create a file named +# "/etc/systemd/system/mariadb.service.d/limits.conf" containing: +# [Service] +# LimitNOFILE=10000 + +# Note: /usr/lib/... is recommended in the .include line though /lib/... +# still works. +# Don't forget to reload systemd daemon after you change unit configuration: +# root> systemctl --system daemon-reload + +[Unit] +Description=MariaDB @MAJOR_VERSION@.@MINOR_VERSION@ database server +After=syslog.target +After=network.target +BindsTo=@RPM_PACKAGE_PREFIX@mysqld.service + +[Service] +Type=simple +User=mysql +Group=mysql + +ExecStartPre=@libexecdir@/mariadb-check-socket +ExecStartPre=@libexecdir@/mariadb-prepare-db-dir %n +# Note: we set --basedir to prevent probes that might trigger SELinux alarms, +# per bug #547485 +ExecStart=@bindir@/mysqld_safe --basedir=@prefix@ +ExecStartPost=@libexecdir@/mariadb-wait-ready $MAINPID + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true + +[Install] +WantedBy=multi-user.target +Also=@RPM_PACKAGE_PREFIX@mysqld.service diff --git a/mariadb.spec b/mariadb.spec index 2d5f39b..1e836c2 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -68,20 +68,20 @@ URL: http://mariadb.org License: GPLv2 with exceptions and LGPLv2 and BSD Source0: http://mirrors.syringanetworks.net/mariadb/mariadb-%{version}/source/mariadb-%{version}.tar.gz -Source2: mysql_config.sh +Source2: mysql_config_multilib.sh Source3: my.cnf Source4: my_config.h Source5: README.mysql-cnf Source6: README.mysql-docs Source7: README.mysql-license Source9: mysql-embedded-check.c -Source10: mariadb.tmpfiles.d -Source11: mariadb.service -Source12: mariadb-prepare-db-dir -Source13: mariadb-wait-ready -Source14: mariadb-check-socket -Source15: mariadb-scripts-common -Source16: mysqld.service +Source10: mariadb.tmpfiles.d.in +Source11: mariadb.service.in +Source12: mariadb-prepare-db-dir.sh +Source13: mariadb-wait-ready.sh +Source14: mariadb-check-socket.sh +Source15: mariadb-scripts-common.sh +Source16: mysqld.service.in Source50: rh-skipped-tests-base.list Source51: rh-skipped-tests-intel.list Source52: rh-skipped-tests-arm.list @@ -104,6 +104,7 @@ Patch12: mariadb-covscan-stroverflow.patch Patch13: mariadb-config.patch Patch14: mariadb-ssltest.patch Patch15: mariadb-mysql_config.patch +Patch16: mariadb-scripts.patch BuildRequires: perl, readline-devel, openssl-devel BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel @@ -335,6 +336,7 @@ MariaDB is a community developed branch of MySQL. %patch13 -p1 %patch14 -p1 %patch15 -p1 +%patch16 -p1 # workaround for upstream bug #56342 rm -f mysql-test/t/ssl_8k_key-master.opt @@ -359,6 +361,8 @@ cat %{SOURCE53} >> mysql-test/rh-skipped-tests.list cat %{SOURCE54} >> mysql-test/rh-skipped-tests.list %endif +cp %{SOURCE2} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} \ + %{SOURCE15} %{SOURCE16} scripts %build @@ -401,6 +405,7 @@ export LDFLAGS cmake . -DBUILD_CONFIG=mysql_release \ -DFEATURE_SET="community" \ -DINSTALL_LAYOUT=RPM \ + -DRPM_PACKAGE_PREFIX="" \ -DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \ -DCMAKE_INSTALL_PREFIX="%{_prefix}" \ %if 0%{?fedora} >= 20 @@ -510,7 +515,7 @@ mv %{buildroot}%{_includedir}/mysql/private/config.h %{buildroot}%{_includedir}/ install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/ install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/private/config.h mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} -install -p -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/mysql_config +install -p -m 0755 scripts/mysql_config_multilib %{buildroot}%{_bindir}/mysql_config %endif # install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, @@ -538,17 +543,17 @@ install -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/ # install systemd unit files and scripts for handling server startup mkdir -p %{buildroot}%{_unitdir} -install -p -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service +install -p -m 644 scripts/mariadb.service %{buildroot}%{_unitdir}/%{name}.service %if %{?with_mysqld_unit} -install -p -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/ +install -p -m 644 scripts/mysqld.service %{buildroot}%{_unitdir}/mysqld.service %endif -install -p -m 755 %{SOURCE12} %{buildroot}%{_libexecdir}/ -install -p -m 755 %{SOURCE13} %{buildroot}%{_libexecdir}/ -install -p -m 755 %{SOURCE14} %{buildroot}%{_libexecdir}/ -install -p -m 644 %{SOURCE15} %{buildroot}%{_libexecdir}/ +install -p -m 755 scripts/mariadb-prepare-db-dir %{buildroot}%{_libexecdir}/mariadb-prepare-db-dir +install -p -m 755 scripts/mariadb-wait-ready %{buildroot}%{_libexecdir}/mariadb-wait-ready +install -p -m 755 scripts/mariadb-check-socket %{buildroot}%{_libexecdir}/mariadb-check-socket +install -p -m 644 scripts/mariadb-scripts-common %{buildroot}%{_libexecdir}/mariadb-scripts-common mkdir -p %{buildroot}%{_tmpfilesdir} -install -p -m 0644 %{SOURCE10} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -p -m 0644 scripts/mariadb.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{name}.conf # Remove libmysqld.a rm -f %{buildroot}%{_libdir}/mysql/libmysqld.a @@ -816,10 +821,10 @@ fi %{?with_mysqld_unit:%{_unitdir}/mysqld.service} %{_unitdir}/%{name}.service -%{_libexecdir}/%{basename:%{SOURCE12}} -%{_libexecdir}/%{basename:%{SOURCE13}} -%{_libexecdir}/%{basename:%{SOURCE14}} -%{_libexecdir}/%{basename:%{SOURCE15}} +%{_libexecdir}/mariadb-prepare-db-dir +%{_libexecdir}/mariadb-wait-ready +%{_libexecdir}/mariadb-check-socket +%{_libexecdir}/mariadb-scripts-common %{_tmpfilesdir}/%{name}.conf %attr(0755,mysql,mysql) %dir %{_localstatedir}/run/mysqld @@ -878,6 +883,7 @@ fi - Use modern symbol filtering with compatible backup - Add more groupnames for server's my.cnf - Error messages now provided by a separate package (thanks Alexander Barkov) +- Expand paths in helper scripts using cmake * Wed Jun 18 2014 Mikko Tiihonen - 1:10.0.12-2 - Use -fno-delete-null-pointer-checks to avoid segfaults with gcc 4.9 diff --git a/mariadb.tmpfiles.d b/mariadb.tmpfiles.d deleted file mode 100644 index fbfe4d9..0000000 --- a/mariadb.tmpfiles.d +++ /dev/null @@ -1,2 +0,0 @@ -d /var/run/mysqld 0755 mysql mysql - -d /var/run/mariadb 0755 mysql mysql - diff --git a/mariadb.tmpfiles.d.in b/mariadb.tmpfiles.d.in new file mode 100644 index 0000000..a1b20aa --- /dev/null +++ b/mariadb.tmpfiles.d.in @@ -0,0 +1,2 @@ +d /var/run/@RPM_PACKAGE_PREFIX@mysqld 0755 mysql mysql - +d /var/run/@RPM_PACKAGE_PREFIX@mariadb 0755 mysql mysql - diff --git a/mysql_config.sh b/mysql_config.sh deleted file mode 100644 index 4849e95..0000000 --- a/mysql_config.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/bash -# -# Wrapper script for mysql_config to support multilib -# -# This command respects setarch - -bits=$(rpm --eval %__isa_bits) - -case $bits in - 32|64) status=known ;; - *) status=unknown ;; -esac - -if [ "$status" = "unknown" ] ; then - echo "$0: error: command 'rpm --eval %__isa_bits' returned unknown value: $bits" - exit 1 -fi - - -if [ -x /usr/bin/mysql_config-$bits ] ; then - /usr/bin/mysql_config-$bits "$@" -else - echo "$0: error: needed binary: /usr/bin/mysql_config-$bits is missing" - exit 1 -fi - diff --git a/mysql_config_multilib.sh b/mysql_config_multilib.sh new file mode 100644 index 0000000..06c2a2b --- /dev/null +++ b/mysql_config_multilib.sh @@ -0,0 +1,26 @@ +#! /bin/sh +# +# Wrapper script for mysql_config to support multilib +# +# This command respects setarch + +bits=$(rpm --eval %__isa_bits) + +case $bits in + 32|64) status=known ;; + *) status=unknown ;; +esac + +if [ "$status" = "unknown" ] ; then + echo "$0: error: command 'rpm --eval %__isa_bits' returned unknown value: $bits" + exit 1 +fi + + +if [ -x @bindir@/mysql_config-$bits ] ; then + @bindir@/mysql_config-$bits "$@" +else + echo "$0: error: needed binary: @bindir@/mysql_config-$bits is missing" + exit 1 +fi + diff --git a/mysqld.service b/mysqld.service deleted file mode 100644 index fad58b7..0000000 --- a/mysqld.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=MySQL compatibility service (another name for mariadb.service; you should use mariadb.service instead) -BindsTo=mariadb.service - -[Service] -Type=oneshot -ExecStart=/bin/true -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target -Also=mariadb.service diff --git a/mysqld.service.in b/mysqld.service.in new file mode 100644 index 0000000..50f4b49 --- /dev/null +++ b/mysqld.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=MySQL compatibility service (another name for @RPM_PACKAGE_PREFIX@mariadb.service; you should use @RPM_PACKAGE_PREFIX@mariadb.service instead) +BindsTo=@RPM_PACKAGE_PREFIX@mariadb.service + +[Service] +Type=oneshot +ExecStart=/bin/true +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target +Also=@RPM_PACKAGE_PREFIX@mariadb.service