Expand paths in helper scripts using cmake

This commit is contained in:
Honza Horak 2014-07-21 14:41:04 +02:00
parent b10bd5019e
commit 5eaeb51ae7
11 changed files with 60 additions and 54 deletions

View File

@ -10,7 +10,7 @@ source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common"
SERVICE_NAME="$1"
if [ x"$SERVICE_NAME" = x ]
then
SERVICE_NAME=mariadb.service
SERVICE_NAME=@RPM_PACKAGE_PREFIX@mariadb.service
fi
myuser=`systemctl show -p User "${SERVICE_NAME}" |
@ -61,11 +61,11 @@ if [ ! -d "$datadir/mysql" ] ; then
# Now create the database
echo "Initializing MySQL database"
/usr/bin/mysql_install_db --datadir="$datadir" --user="$myuser"
@bindir@/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
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"/*

View File

@ -38,9 +38,9 @@ get_mysql_option(){
# must correspond with values defined in mysqld_safe script and source
# code itself.
server_sections="mysqld_safe mysqld server mariadb"
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 "/var/lib/mysql"
get_mysql_option "$server_sections" datadir "@MYSQL_DATADIR@"
datadir="$result"
# if there is log_error in the my.cnf, my_print_defaults still
@ -50,7 +50,7 @@ datadir="$result"
get_mysql_option "$server_sections" log-error "`hostname`.err"
errlogfile="$result"
get_mysql_option "$server_sections" socket "/var/lib/mysql/mysql.sock"
get_mysql_option "$server_sections" socket "@MYSQL_UNIX_ADDR@"
socketfile="$result"
get_mysql_option "$server_sections" pid-file "`hostname`.pid"

View File

@ -11,7 +11,7 @@ source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common"
if [ $# -ne 1 ] ; then
echo "You need to pass daemon pid as an argument for this script."
exit 20
fi
fi
# Service file passes us the daemon's PID (actually, mysqld_safe's PID)
daemon_pid="$1"
@ -24,7 +24,7 @@ while /bin/true; do
ret=1
break
fi
RESPONSE=`/usr/bin/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
RESPONSE=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
mret=$?
if [ $mret -eq 0 ] ; then
break

View File

@ -17,28 +17,28 @@
# [Service]
# LimitNOFILE=10000
# Note: /usr/lib/... is recommended in the .include line though /lib/...
# 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
Description=MariaDB @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target
After=network.target
BindsTo=mysqld.service
BindsTo=@RPM_PACKAGE_PREFIX@mysqld.service
[Service]
Type=simple
User=mysql
Group=mysql
ExecStartPre=/usr/libexec/mariadb-check-socket
ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n
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=/usr/bin/mysqld_safe --basedir=/usr
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID
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
@ -48,4 +48,4 @@ PrivateTmp=true
[Install]
WantedBy=multi-user.target
Also=mysqld.service
Also=@RPM_PACKAGE_PREFIX@mysqld.service

View File

@ -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 <mikko.tiihonen@iki.fi> - 1:10.0.12-2
- Use -fno-delete-null-pointer-checks to avoid segfaults with gcc 4.9

View File

@ -1,2 +0,0 @@
d /var/run/mysqld 0755 mysql mysql -
d /var/run/mariadb 0755 mysql mysql -

2
mariadb.tmpfiles.d.in Normal file
View File

@ -0,0 +1,2 @@
d /var/run/@RPM_PACKAGE_PREFIX@mysqld 0755 mysql mysql -
d /var/run/@RPM_PACKAGE_PREFIX@mariadb 0755 mysql mysql -

View File

@ -1,4 +1,4 @@
#! /bin/bash
#! /bin/sh
#
# Wrapper script for mysql_config to support multilib
#
@ -17,10 +17,10 @@ if [ "$status" = "unknown" ] ; then
fi
if [ -x /usr/bin/mysql_config-$bits ] ; then
/usr/bin/mysql_config-$bits "$@"
if [ -x @bindir@/mysql_config-$bits ] ; then
@bindir@/mysql_config-$bits "$@"
else
echo "$0: error: needed binary: /usr/bin/mysql_config-$bits is missing"
echo "$0: error: needed binary: @bindir@/mysql_config-$bits is missing"
exit 1
fi

View File

@ -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

12
mysqld.service.in Normal file
View File

@ -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