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" SERVICE_NAME="$1"
if [ x"$SERVICE_NAME" = x ] if [ x"$SERVICE_NAME" = x ]
then then
SERVICE_NAME=mariadb.service SERVICE_NAME=@RPM_PACKAGE_PREFIX@mariadb.service
fi fi
myuser=`systemctl show -p User "${SERVICE_NAME}" | myuser=`systemctl show -p User "${SERVICE_NAME}" |
@ -61,11 +61,11 @@ if [ ! -d "$datadir/mysql" ] ; then
# Now create the database # Now create the database
echo "Initializing MySQL database" echo "Initializing MySQL database"
/usr/bin/mysql_install_db --datadir="$datadir" --user="$myuser" @bindir@/mysql_install_db --datadir="$datadir" --user="$myuser"
ret=$? ret=$?
if [ $ret -ne 0 ] ; then if [ $ret -ne 0 ] ; then
echo "Initialization of MySQL database failed." >&2 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 # Clean up any partially-created database files
if [ ! -e "$datadir/mysql/user.frm" ] ; then if [ ! -e "$datadir/mysql/user.frm" ] ; then
rm -rf "$datadir"/* rm -rf "$datadir"/*

View File

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

View File

@ -24,7 +24,7 @@ while /bin/true; do
ret=1 ret=1
break break
fi 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=$? mret=$?
if [ $mret -eq 0 ] ; then if [ $mret -eq 0 ] ; then
break break

View File

@ -23,22 +23,22 @@
# root> systemctl --system daemon-reload # root> systemctl --system daemon-reload
[Unit] [Unit]
Description=MariaDB database server Description=MariaDB @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target After=syslog.target
After=network.target After=network.target
BindsTo=mysqld.service BindsTo=@RPM_PACKAGE_PREFIX@mysqld.service
[Service] [Service]
Type=simple Type=simple
User=mysql User=mysql
Group=mysql Group=mysql
ExecStartPre=/usr/libexec/mariadb-check-socket ExecStartPre=@libexecdir@/mariadb-check-socket
ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n ExecStartPre=@libexecdir@/mariadb-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms, # Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485 # per bug #547485
ExecStart=/usr/bin/mysqld_safe --basedir=/usr ExecStart=@bindir@/mysqld_safe --basedir=@prefix@
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID ExecStartPost=@libexecdir@/mariadb-wait-ready $MAINPID
# Give a reasonable amount of time for the server to start up/shut down # Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300 TimeoutSec=300
@ -48,4 +48,4 @@ PrivateTmp=true
[Install] [Install]
WantedBy=multi-user.target 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 License: GPLv2 with exceptions and LGPLv2 and BSD
Source0: http://mirrors.syringanetworks.net/mariadb/mariadb-%{version}/source/mariadb-%{version}.tar.gz 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 Source3: my.cnf
Source4: my_config.h Source4: my_config.h
Source5: README.mysql-cnf Source5: README.mysql-cnf
Source6: README.mysql-docs Source6: README.mysql-docs
Source7: README.mysql-license Source7: README.mysql-license
Source9: mysql-embedded-check.c Source9: mysql-embedded-check.c
Source10: mariadb.tmpfiles.d Source10: mariadb.tmpfiles.d.in
Source11: mariadb.service Source11: mariadb.service.in
Source12: mariadb-prepare-db-dir Source12: mariadb-prepare-db-dir.sh
Source13: mariadb-wait-ready Source13: mariadb-wait-ready.sh
Source14: mariadb-check-socket Source14: mariadb-check-socket.sh
Source15: mariadb-scripts-common Source15: mariadb-scripts-common.sh
Source16: mysqld.service Source16: mysqld.service.in
Source50: rh-skipped-tests-base.list Source50: rh-skipped-tests-base.list
Source51: rh-skipped-tests-intel.list Source51: rh-skipped-tests-intel.list
Source52: rh-skipped-tests-arm.list Source52: rh-skipped-tests-arm.list
@ -104,6 +104,7 @@ Patch12: mariadb-covscan-stroverflow.patch
Patch13: mariadb-config.patch Patch13: mariadb-config.patch
Patch14: mariadb-ssltest.patch Patch14: mariadb-ssltest.patch
Patch15: mariadb-mysql_config.patch Patch15: mariadb-mysql_config.patch
Patch16: mariadb-scripts.patch
BuildRequires: perl, readline-devel, openssl-devel BuildRequires: perl, readline-devel, openssl-devel
BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel
@ -335,6 +336,7 @@ MariaDB is a community developed branch of MySQL.
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch15 -p1 %patch15 -p1
%patch16 -p1
# workaround for upstream bug #56342 # workaround for upstream bug #56342
rm -f mysql-test/t/ssl_8k_key-master.opt 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 cat %{SOURCE54} >> mysql-test/rh-skipped-tests.list
%endif %endif
cp %{SOURCE2} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} \
%{SOURCE15} %{SOURCE16} scripts
%build %build
@ -401,6 +405,7 @@ export LDFLAGS
cmake . -DBUILD_CONFIG=mysql_release \ cmake . -DBUILD_CONFIG=mysql_release \
-DFEATURE_SET="community" \ -DFEATURE_SET="community" \
-DINSTALL_LAYOUT=RPM \ -DINSTALL_LAYOUT=RPM \
-DRPM_PACKAGE_PREFIX="" \
-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \ -DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \ -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
%if 0%{?fedora} >= 20 %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/
install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/private/config.h install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/private/config.h
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits} 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 %endif
# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files, # 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 # install systemd unit files and scripts for handling server startup
mkdir -p %{buildroot}%{_unitdir} 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} %if %{?with_mysqld_unit}
install -p -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/ install -p -m 644 scripts/mysqld.service %{buildroot}%{_unitdir}/mysqld.service
%endif %endif
install -p -m 755 %{SOURCE12} %{buildroot}%{_libexecdir}/ install -p -m 755 scripts/mariadb-prepare-db-dir %{buildroot}%{_libexecdir}/mariadb-prepare-db-dir
install -p -m 755 %{SOURCE13} %{buildroot}%{_libexecdir}/ install -p -m 755 scripts/mariadb-wait-ready %{buildroot}%{_libexecdir}/mariadb-wait-ready
install -p -m 755 %{SOURCE14} %{buildroot}%{_libexecdir}/ install -p -m 755 scripts/mariadb-check-socket %{buildroot}%{_libexecdir}/mariadb-check-socket
install -p -m 644 %{SOURCE15} %{buildroot}%{_libexecdir}/ install -p -m 644 scripts/mariadb-scripts-common %{buildroot}%{_libexecdir}/mariadb-scripts-common
mkdir -p %{buildroot}%{_tmpfilesdir} 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 # Remove libmysqld.a
rm -f %{buildroot}%{_libdir}/mysql/libmysqld.a rm -f %{buildroot}%{_libdir}/mysql/libmysqld.a
@ -816,10 +821,10 @@ fi
%{?with_mysqld_unit:%{_unitdir}/mysqld.service} %{?with_mysqld_unit:%{_unitdir}/mysqld.service}
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
%{_libexecdir}/%{basename:%{SOURCE12}} %{_libexecdir}/mariadb-prepare-db-dir
%{_libexecdir}/%{basename:%{SOURCE13}} %{_libexecdir}/mariadb-wait-ready
%{_libexecdir}/%{basename:%{SOURCE14}} %{_libexecdir}/mariadb-check-socket
%{_libexecdir}/%{basename:%{SOURCE15}} %{_libexecdir}/mariadb-scripts-common
%{_tmpfilesdir}/%{name}.conf %{_tmpfilesdir}/%{name}.conf
%attr(0755,mysql,mysql) %dir %{_localstatedir}/run/mysqld %attr(0755,mysql,mysql) %dir %{_localstatedir}/run/mysqld
@ -878,6 +883,7 @@ fi
- Use modern symbol filtering with compatible backup - Use modern symbol filtering with compatible backup
- Add more groupnames for server's my.cnf - Add more groupnames for server's my.cnf
- Error messages now provided by a separate package (thanks Alexander Barkov) - 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 * 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 - 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 # Wrapper script for mysql_config to support multilib
# #
@ -17,10 +17,10 @@ if [ "$status" = "unknown" ] ; then
fi fi
if [ -x /usr/bin/mysql_config-$bits ] ; then if [ -x @bindir@/mysql_config-$bits ] ; then
/usr/bin/mysql_config-$bits "$@" @bindir@/mysql_config-$bits "$@"
else 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 exit 1
fi 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