]> TLD Linux GIT Repositories - packages/mysql.git/commitdiff
- moved router to separate package, added mysqlrouter user/group, fixed
authorMarcin Krol <hawk@tld-linux.org>
Thu, 25 Apr 2024 00:38:52 +0000 (02:38 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Thu, 25 Apr 2024 00:38:52 +0000 (02:38 +0200)
  router paths

mysql.spec

index 1b9905c95b0bbe964f532e9abbaeb70ea7158ed9..39a6570535f7bdd518c1605942a0b2f7e1eaab66 100644 (file)
@@ -26,7 +26,7 @@ Summary(uk.UTF-8):    MySQL - швидкий SQL-сервер
 Summary(zh_CN.UTF-8):  MySQL数据库服务器
 Name:          mysql-%{mysqlversion}
 Version:       8.0.36
-Release:        1
+Release:        2
 License:       GPL v2 + MySQL FOSS License Exception
 Group:         Applications/Databases
 Source0:       http://cdn.mysql.com/Downloads/MySQL-%{mysqlversion}/mysql-%{version}.tar.gz
@@ -460,6 +460,22 @@ This package contains the standard MySQL NDB CPC Daemon.
 %description ndb-cpc -l pl.UTF-8
 Ten pakiet zawiera standardowego demona MySQL NDB CPC.
 
+%package router
+Summary:       MySQL Router
+Summary(pl.UTF-8):     MySQL Router
+Group:         Applications/Databases
+Requires:      alternatives
+Requires:      %{name}-dirs = %{version}-%{release}
+Requires:      %{name}-libs = %{version}-%{release}
+
+%description router
+The MySQL Router software delivers a fast, multi-threaded way of
+routing connections from MySQL Clients to MySQL Servers.
+
+%description router -l pl.UTF-8
+Oprogramowanie MySQL Router zapewnia szybki i wielowątkowy sposób
+przekierowywania połączeń od klientów MySQL do serwerów MySQL.
+
 %prep
 %setup -q %{?with_sphinx:-a100} %{!?with_system_boost:-a101} -n mysql-%{version}
 
@@ -501,21 +517,23 @@ CPPFLAGS="%{rpmcppflags}" \
        %{?with_systemtap:-DENABLE_DTRACE=ON} \
        -DFEATURE_SET="community" \
        -DINSTALL_LAYOUT=RPM \
-        -DINSTALL_BINDIR=%{mysqllibdir}/bin \
-        -DINSTALL_SBINDIR=%{mysqllibdir}/sbin \
-        -DINSTALL_MANDIR=%{mysqldatadir}/man \
-        -DINSTALL_LIBDIR=%{_lib} \
-        -DINSTALL_PRIV_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/private \
+       -DINSTALL_BINDIR=%{mysqllibdir}/bin \
+       -DINSTALL_SBINDIR=%{mysqllibdir}/sbin \
+       -DINSTALL_MANDIR=%{mysqldatadir}/man \
+       -DINSTALL_LIBDIR=%{_lib} \
+       -DINSTALL_PRIV_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/private \
        -DINSTALL_MYSQLTESTDIR_RPM="" \
        -DINSTALL_MYSQLDATADIR=/var/lib/mysql/%{mysqlversion} \
        -DINSTALL_PLUGINDIR=%{_lib}/mysql/%{mysqlversion}/plugin \
-        -DINSTALL_SECURE_FILE_PRIVDIR=/var/lib/mysql-files/%{mysqlversion} \
+       -DINSTALL_SECURE_FILE_PRIVDIR=/var/lib/mysql-files/%{mysqlversion} \
        -DINSTALL_SQLBENCHDIR=%{_datadir} \
        -DINSTALL_SUPPORTFILESDIR=share/mysql/%{mysqlversion}/support \
        -DINSTALL_MYSQLSHAREDIR=share/mysql/%{mysqlversion}/lang \
        -DINSTALL_MYSQLTESTDIR=share/mysql/%{mysqlversion}/test \
-        -DROUTER_INSTALL_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/router/private \
-        -DROUTER_INSTALL_PLUGINDIR=%{_libdir}/mysql/%{mysqlversion}/router \
+       -DROUTER_INSTALL_DATADIR=/var/lib/mysqlrouter/%{mysqlversion} \
+       -DROUTER_INSTALL_LIBDIR=%{_libdir}/mysql/%{mysqlversion}/router/private \
+       -DROUTER_INSTALL_LOGDIR=/var/log/mysqlrouter/%{mysqlversion} \
+       -DROUTER_INSTALL_PLUGINDIR=%{_libdir}/mysql/%{mysqlversion}/router \
        -DMYSQL_UNIX_ADDR=/var/lib/mysql/%{mysqlversion}/mysql.sock \
        %{?debug:-DWITH_DEBUG=ON} \
        -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
@@ -529,7 +547,7 @@ CPPFLAGS="%{rpmcppflags}" \
        -DWITH_LZ4=system \
        -DWITH_PROTOBUF=system \
        -DWITH_SASL=system \
-        -DWITH_UNIT_TESTS=%{?with_tests:ON}%{!?with_tests:OFF} \
+       -DWITH_UNIT_TESTS=%{?with_tests:ON}%{!?with_tests:OFF} \
        -DWITH_SSL=%{?with_ssl:system}%{!?with_ssl:no} \
        %{!?with_system_boost:-DWITH_BOOST="$(pwd)/$(ls -1d ../boost_*)"} \
        -DWITH_ZLIB=system \
@@ -543,8 +561,8 @@ CPPFLAGS="%{rpmcppflags}" \
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql/%{mysqlversion},skel} \
-          $RPM_BUILD_ROOT/var/{log/{archive,}/mysql/%{mysqlversion},lib/{mysql,mysql-files}/%{mysqlversion}} \
+install -d $RPM_BUILD_ROOT/etc/{ld.so.conf.d,logrotate.d,rc.d/init.d,sysconfig,mysql/%{mysqlversion},skel} \
+          $RPM_BUILD_ROOT/var/{lib/mysqlrouter,log/{archive,}/{mysql,mysqlrouter}/%{mysqlversion},lib/{mysql,mysql-files}/%{mysqlversion}} \
           $RPM_BUILD_ROOT%{_libdir}
 
 %{__make} -C build install \
@@ -557,9 +575,12 @@ sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE3} >$RPM_BUILD_ROOT/etc/log
 sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE4} >mysqld.conf
 sed -e 's,@mysqlversion@,%{mysqlversion},g;' %{SOURCE5} >$RPM_BUILD_ROOT%{_sysconfdir}/mysql/%{mysqlversion}/clusters.conf
 touch $RPM_BUILD_ROOT/var/log/mysql/%{mysqlversion}/{mysqld,query,slow}.log
+touch $RPM_BUILD_ROOT/var/log/mysqlrouter/%{mysqlversion}/mysqlrouter.log
 
 mv $RPM_BUILD_ROOT/etc/logrotate.d/{mysqlrouter,%{name}-router}
 
+echo "%{_libdir}/mysql/%{mysqlversion}/router/private" >$RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-router.conf
+
 # remove innodb directives from mysqld.conf if mysqld is configured without
 %if %{without innodb}
        cp mysqld.conf mysqld.tmp
@@ -661,18 +682,6 @@ update-alternatives \
 update-alternatives \
        --install %{_bindir}/mysql_migrate_keyring mysql_migrate_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysql_migrate_keyring %{mysqlpriority} \
        --slave %{_mandir}/man1/mysql_migrate_keyring.1 mysql_migrate_keyring.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysql_migrate_keyring.1* || :
-update-alternatives \
-       --install %{_bindir}/mysqlrouter mysqlrouter %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter %{mysqlpriority} \
-       --slave %{_mandir}/man1/mysqlrouter.1 mysqlrouter.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter.1* || :
-update-alternatives \
-       --install %{_bindir}/mysqlrouter_keyring mysqlrouter_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring %{mysqlpriority} \
-       --slave %{_mandir}/man1/mysqlrouter_keyring.1 mysqlrouter_keyring.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_keyring.1* || :
-update-alternatives \
-       --install %{_bindir}/mysqlrouter_passwd mysqlrouter_passwd %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd %{mysqlpriority} \
-       --slave %{_mandir}/man1/mysqlrouter_passwd.1 mysqlrouter_passwd.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_passwd.1* || :
-update-alternatives \
-       --install %{_bindir}/mysqlrouter_plugin_info mysqlrouter_plugin_info %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info %{mysqlpriority} \
-       --slave %{_mandir}/man1/mysqlrouter_plugin_info.1 mysqlrouter_plugin_info.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_plugin_info.1* || :
 update-alternatives \
        --install %{_sbindir}/innochecksum innochecksum %{_libdir}/mysql/%{mysqlversion}/sbin/innochecksum %{mysqlpriority} \
        --slave %{_mandir}/man1/innochecksum.1 innochecksum.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/innochecksum.1* || :
@@ -703,10 +712,6 @@ update-alternatives \
 if [ "$1" = "0" ]; then
        update-alternatives --remove ibd2sdi %{_libdir}/mysql/%{mysqlversion}/bin/ibd2sdi || :
        update-alternatives --remove mysql_migrate_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysql_migrate_keyring || :
-       update-alternatives --remove mysqlrouter %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter || :
-       update-alternatives --remove mysqlrouter_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring || :
-       update-alternatives --remove mysqlrouter_passwd %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd || :
-       update-alternatives --remove mysqlrouter_plugin_info %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info || :
        update-alternatives --remove innochecksum %{_libdir}/mysql/%{mysqlversion}/sbin/innochecksum || :
        update-alternatives --remove my_print_defaults %{_libdir}/mysql/%{mysqlversion}/sbin/my_print_defaults || :
        update-alternatives --remove myisamchk %{_libdir}/mysql/%{mysqlversion}/sbin/myisamchk || :
@@ -948,19 +953,46 @@ fi
 %post  libs -p /sbin/ldconfig
 %postun        libs -p /sbin/ldconfig
 
+%pre router
+%groupadd -g 348 mysqlrouter
+%useradd -u 348 -d /var/lib/mysqlrouter -s /bin/false -g mysqlrouter -c "MySQL Router" mysqlrouter
+
+%post  router
+/sbin/ldconfig
+
+%posttrans router
+update-alternatives \
+       --install %{_bindir}/mysqlrouter mysqlrouter %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter %{mysqlpriority} \
+       --slave %{_mandir}/man1/mysqlrouter.1 mysqlrouter.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter.1* || :
+update-alternatives \
+       --install %{_bindir}/mysqlrouter_keyring mysqlrouter_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring %{mysqlpriority} \
+       --slave %{_mandir}/man1/mysqlrouter_keyring.1 mysqlrouter_keyring.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_keyring.1* || :
+update-alternatives \
+       --install %{_bindir}/mysqlrouter_passwd mysqlrouter_passwd %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd %{mysqlpriority} \
+       --slave %{_mandir}/man1/mysqlrouter_passwd.1 mysqlrouter_passwd.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_passwd.1* || :
+update-alternatives \
+       --install %{_bindir}/mysqlrouter_plugin_info mysqlrouter_plugin_info %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info %{mysqlpriority} \
+       --slave %{_mandir}/man1/mysqlrouter_plugin_info.1 mysqlrouter_plugin_info.1 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_plugin_info.1* || :
+
+%postun        router
+/sbin/ldconfig
+if [ "$1" = "0" ]; then
+       update-alternatives --remove mysqlrouter %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter || :
+       update-alternatives --remove mysqlrouter_keyring %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring || :
+       update-alternatives --remove mysqlrouter_passwd %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd || :
+       update-alternatives --remove mysqlrouter_plugin_info %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info || :
+       %userremove mysqlrouter
+       %groupremove mysqlrouter
+fi
+
 %files
 %defattr(644,root,root,755)
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}-router
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %attr(640,root,mysql) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mysql/%{mysqlversion}/clusters.conf
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/ibd2sdi
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysql_migrate_keyring
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/innochecksum
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/my_print_defaults
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/sbin/myisamchk
@@ -1011,24 +1043,6 @@ fi
 %attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/plugin/ha_sphinx.so
 %endif
 %{_libdir}/mysql/%{mysqlversion}/private/icudt*l
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/connection_pool.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/destination_status.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_auth_backend.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_auth_realm.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_server.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/io.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/keepalive.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/metadata_cache.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_api.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_connection_pool.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_metadata_cache.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_router.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_routing.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_openssl.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_protobuf.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/routing.so
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlharness*.so*
-%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlrouter*.so*
 %{_datadir}/mysql/%{mysqlversion}/man/man1/ibd2sdi.1*
 %{_datadir}/mysql/%{mysqlversion}/man/man1/innochecksum.1*
 %{_datadir}/mysql/%{mysqlversion}/man/man1/my_print_defaults.1*
@@ -1037,9 +1051,6 @@ fi
 %{_datadir}/mysql/%{mysqlversion}/man/man1/myisampack.1*
 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysql_upgrade.1*
 %{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlcheck.1*
-%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter.1*
-%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_passwd.1*
-%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_plugin_info.1*
 %{_datadir}/mysql/%{mysqlversion}/man/man8/mysqld.8*
 
 %if %{?debug:1}0
@@ -1112,8 +1123,6 @@ fi
 %dir %{_libdir}/mysql/%{mysqlversion}/sbin
 %dir %{_libdir}/mysql/%{mysqlversion}/plugin
 %dir %{_libdir}/mysql/%{mysqlversion}/private
-%dir %{_libdir}/mysql/%{mysqlversion}/router
-%dir %{_libdir}/mysql/%{mysqlversion}/router/private
 %dir %{_datadir}/mysql/%{mysqlversion}
 %dir %{_datadir}/mysql/%{mysqlversion}/man
 %dir %{_datadir}/mysql/%{mysqlversion}/man/man1
@@ -1248,3 +1257,40 @@ fi
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mysql-ndb-cpc
 %{_datadir}/mysql/%{mysqlversion}/man/man1/ndb_cpcd.1*
 %endif
+
+%files router
+%defattr(644,root,root,755)
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}-router
+%{_sysconfdir}/ld.so.conf.d/%{name}-router.conf
+%dir %{_libdir}/mysql/%{mysqlversion}/router
+%dir %{_libdir}/mysql/%{mysqlversion}/router/private
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_keyring
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_passwd
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/bin/mysqlrouter_plugin_info
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/connection_pool.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/destination_status.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_auth_backend.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_auth_realm.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/http_server.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/io.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/keepalive.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/metadata_cache.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_api.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_connection_pool.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_metadata_cache.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_router.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/rest_routing.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_openssl.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/router_protobuf.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/routing.so
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlharness*.so*
+%attr(755,root,root) %{_libdir}/mysql/%{mysqlversion}/router/private/libmysqlrouter*.so*
+%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter.1*
+%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_passwd.1*
+%{_datadir}/mysql/%{mysqlversion}/man/man1/mysqlrouter_plugin_info.1*
+%attr(751,root,root) %dir /var/lib/mysqlrouter
+%attr(751,root,root) %dir /var/log/mysqlrouter
+%attr(750,mysqlrouter,mysqlrouter) %dir /var/log/mysqlrouter/%{mysqlversion}
+%attr(750,mysqlrouter,mysqlrouter) %dir /var/log/archive/mysqlrouter/%{mysqlversion}
+%attr(640,mysql,mysql) %ghost /var/log/mysqlrouter/%{mysqlversion}/*