--- rpms/smeserver-mysql/sme10/smeserver-mysql.spec 2022/03/13 02:38:23 1.1 +++ rpms/smeserver-mysql/sme10/smeserver-mysql.spec 2024/09/01 04:21:50 1.35 @@ -2,16 +2,25 @@ Summary: Koozali SME Server specific mys %define name smeserver-mysql Name: %{name} %define version 2.7.0 -%define release 1 +%define release 19 Version: %{version} Release: %{release}%{?dist} License: GPL Group: Networking/Daemons Source: %{name}-%{version}.tar.xz +Patch0: smeserver-mysql-2.7.0-bz11899-sclo.patch +Patch1: smeserver-mysql-2.7.0-bz11922-mysqlinit.patch +Patch2: smeserver-mysql-2.7.0-bz11936.patch +Patch3: smeserver-mysql-2.7.0-bz11953-mysql.init-logging.patch +Patch4: smeserver-mysql-2.7.0-bz12262-skipnetworking.patch +Patch5: smeserver-mysql-2.7.0-bz12417-OpenFilesLimit.patch +Patch6: smeserver-mysql-2.7.0-bz12145-backupuserprivileges.patch BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch Requires: mariadb-server +# mariadb after 5.5 /in Centos 8 will package mysql_upgrade in mariadb-server-utils +# Requires: /usr/bin/mysql_upgrade Requires: mariadb Requires: e-smith-base Requires: e-smith-lib >= 1.15.1-19 @@ -27,6 +36,13 @@ mysql. %prep %setup +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build for ver in 101 102 103 105 @@ -48,7 +64,7 @@ do # default values from /etc/opt/rh/rh-mariadb101/my.cnf.d/mariadb-server.cnf basedir="/opt/rh/rh-mariadb$ver/root/usr" datadir="/var/opt/rh/rh-mariadb$ver/lib/mysql" -socket="/var/lib/mysql/maradb$ver.sock" +socket="/var/lib/mysql/mariadb$ver.sock" logerror="/var//log/mariadb$ver/mariadb.log" #"/var/opt/rh/rh-mariadb$ver/log/mariadb/mariadb.log" pidfile="/var/run/rh-mariadb$ver-mariadb/mariadb.pid" @@ -61,7 +77,7 @@ port="${ports[$ver]}" mkdir -p root$ver/etc/e-smith/sql/init$ver mkdir -p root$ver/home/e-smith/db/mariadb$ver mkdir -p root$ver/var/log/mariadb$ver -mkdir -p root$ver/home/e-smith/db/mysql/mariadb$ver +#mkdir -p root$ver/home/e-smith/db/mysql/mariadb$ver mkdir -p root$ver/etc/e-smith/events/actions # create configuration db default @@ -110,11 +126,12 @@ sed -i root$ver/etc/e-smith/events/actio -i root$ver/etc/e-smith/events/actions/mariadb${ver}-delete-dumped-tables \ -i root$ver/etc/e-smith/events/actions/mariadb${ver}-dump-tables \ -i root$ver/etc/e-smith/events/actions/mariadb${ver}-load-tables \ - -e "s_!!!VER!!!_${ver}_g" + -e "s_!!!VER!!!_${ver}_g" \ + -e "s_!!!SOCKET!!!_${socket}_g" ##metadata -mkdir -p root$ver/etc/e-smith/templates.metadata/etc/e-smith/ -cp -a root/etc/e-smith/templates.metadata/etc/e-smith/sql root$ver/etc/e-smith/templates.metadata/etc/e-smith/sql$ver +mkdir -p root$ver/etc/e-smith/templates.metadata/etc/e-smith/sql +cp -a root/etc/e-smith/templates.metadata/etc/e-smith/sql/init root$ver/etc/e-smith/templates.metadata/etc/e-smith/sql/init$ver ##templates @@ -123,9 +140,9 @@ cp root/etc/e-smith/templates/etc/e-sm sed -i root$ver/etc/e-smith/templates/etc/e-smith/sql/init$ver/00_restore_dumped_dbs -i root$ver/etc/e-smith/templates/etc/e-smith/sql/init$ver/10mysql_upgrade \ -e "s_e-smith/db/mysql_e-smith/db/mariadb${ver}_g" \ -e "s_/usr/bin/mysql_/opt/rh/rh-mariadb${ver}/root/usr/bin/mysql_g" \ - -e "s_mariadb.service_rh-mariadb$ver-mariadb.service_" \ + -e "s_mariadb.service_mariadb$ver-mariadb.service_" \ -e "s_/var/run/mariadb/mariadb.pid_${pidfile}_g" \ - -e "s_mysqld_rh-mariadb$ver-mariadb_g" \ + -e "s_mysqld_mariadb$ver-mariadb_g" \ -e "s_| mysql |_| /opt/rh/rh-mariadb${ver}/root/usr/bin/mysql --socket=$socket |_g" \ -e "s_mysql\_upgrade_mysql\_upgrade --socket=$socket _g" mkdir -p root$ver/etc/e-smith/templates/etc/my.cnf @@ -133,10 +150,14 @@ echo " [mariadb-$vers]" > root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-05mariadb echo "basedir=$basedir" > root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-07basedir echo "datadir=$datadir" > root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-08datadir -cp -a root/etc/e-smith/templates/etc/my.cnf/009socket root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-09socket -sed -i root$ver/etc/e-smith/templates/etc/my.cnf/$ver-09socket \ - -e "s_mariadb_{'mariadb${ver}\-mariadb'}_" \ - -e "s_^socket.*_socket=${socket}_" +#cp -a root/etc/e-smith/templates/etc/my.cnf/009socket root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-09socket +#sed -i root$ver/etc/e-smith/templates/etc/my.cnf/$ver-09socket \ +# -e "s_mariadb_{'mariadb${ver}\-mariadb'}_" \ +# -e "s_^socket.*_socket=${socket}_" +cp rootscl/etc/e-smith/templates/etc/my.conf/_VER_-09socket root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-09socket +sed -i root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-09socket \ + -e "s_!!!VER!!!_${ver}_g" \ + -e "s_!!!PORT!!!_${port}_g" cp rootscl/etc/e-smith/templates/etc/my.conf/_VER_-10port root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-10port sed -i root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-10port \ -e "s_!!!VER!!!_${ver}_g" \ @@ -158,13 +179,18 @@ cp rootscl/sbin/e-smith/mariadb_VER_-pre sed -i root$ver/sbin/e-smith/systemd/mariadb${ver}-initialize -i root$ver/sbin/e-smith/systemd/mariadb${ver}-mysql.init \ -i root$ver/sbin/e-smith/mariadb${ver}-preload \ -e "s_!!!VER!!!_${ver}_g" \ - -e "s_!!!SOCKET!!!_$socket _g" + -e "s_!!!SOCKET!!!_${socket}_g" +if [ $ver -ge 104 ] +then + cp rootscl/sbin/e-smith/systemd/mariadb_VER_-post root$ver/sbin/e-smith/systemd/mariadb${ver}-post + sed -i root$ver/sbin/e-smith/systemd/mariadb${ver}-post -e "s_!!!VER!!!_${ver}_g" -e "s_!!!SOCKET!!!_${socket}_g" +fi + ## logrotate mkdir -p root$ver/etc/logrotate.d/ -sed rootscl/etc/logrotate.d/mariadb_VER_ -e "s_!!!VER!!!_${ver}_g" > root$ver/etc/logrotate.d/mariadb${ver} -#cp -a root/etc/e-smith/templates/etc/logrotate.d/mariadb root$ver/etc/e-smith/templates/etc/logrotate.d/mariadb$ver -# TODO sed -i add --socket= and change path +sed rootscl/etc/logrotate.d/mariadb_VER_ -e "s_!!!VER!!!_${ver}_g" \ + -e "s_!!!SOCKET!!!_${socket}_g" > root$ver/etc/logrotate.d/mariadb${ver} #systemd service @@ -175,14 +201,36 @@ cp rootscl/usr/lib/systemd/system/mariad cp rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service root$ver/usr/lib/systemd/system/mariadb${ver}-mysql.init.service sed -i root$ver/usr/lib/systemd/system/mariadb${ver}-mariadb.service -i root$ver/usr/lib/systemd/system/mariadb${ver}-mysql.init.service \ -e "s_!!!VER!!!_${ver}_g" +if [ $ver -ge 102 ] +then + sed -i root$ver/usr/lib/systemd/system/mariadb${ver}-mariadb.service \ + -e "s/_safe//" \ + -e "s/^ExecStopPost.*//"; +fi +if [ $ver -ge 104 ] +then + sed -i root$ver/usr/lib/systemd/system/mariadb${ver}-mariadb.service \ + -e 's_set.password$_set.password2_' + sed -i root$ver/usr/lib/systemd/system/mariadb${ver}-mariadb.service \ + -e "/^#ExecStartPost=/ i ExecStartPost=\/sbin\/e-smith\/systemd\/mariadb${ver}-post" + +fi + #### TODO check it is similar to rh one and functional ! -#/usb/bin to ease user +#/usr/bin to ease user mkdir root$ver/usr/bin for i in mysql mysqlshow mysqladmin mysqldump mysqlimport mysqlbinlog do - echo "/opt/rh/rh-mariadb${ver}/root/usr/bin/$i --socket=/var/lib/mysql/maradb${ver}.sock \"\$\@\" $i" >root$ver/usr/bin/$i${ver} + echo "/opt/rh/rh-mariadb${ver}/root/usr/bin/$i --socket=/var/lib/mysql/mariadb${ver}.sock \"\$@\"" >root$ver/usr/bin/$i${ver} done + +#phpMyAdmin template +mkdir -p root$ver/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/ +sed rootscl/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql_VER_ \ + -e "s_!!!SOCKET!!!_${socket}_g" \ + -e "s_!!!VER!!!_${ver}_g" > root$ver/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql${ver} + done ################################################### @@ -198,6 +246,7 @@ rm -rf $RPM_BUILD_ROOT --file "/sbin/e-smith/systemd/mysql.init" 'attr(0554,root,root)' \ --dir '/home/e-smith/db/mysql' 'attr(0750,root,root)' \ --dir "/var/log/mariadb" 'attr(0750,mysql,mysql)' \ + --dir "/var/log/mysql.init" 'attr(0750,root,root)' \ > %{name}-%{version}-filelist echo "%doc COPYING" >> %{name}-%{version}-filelist @@ -208,8 +257,15 @@ do /sbin/e-smith/genfilelist root$ver/ \ --file "/sbin/e-smith/systemd/mariadb$ver-initialize" 'attr(0554,root,root)' \ --file "/sbin/e-smith/systemd/mariadb$ver-mysql.init" 'attr(0554,root,root)' \ + --file "/sbin/e-smith/systemd/mariadb$ver-post" 'attr(0554,root,root)' \ --dir "/home/e-smith/db/mariadb$ver" 'attr(0750,root,root)' \ --dir "/var/log/mariadb$ver" 'attr(0750,mysql,mysql)' \ + --file "/usr/bin/mysql$ver" 'attr(0554,root,root)' \ + --file "/usr/bin/mysqladmin$ver" 'attr(0554,root,root)' \ + --file "/usr/bin/mysqlbinlog$ver" 'attr(0554,root,root)' \ + --file "/usr/bin/mysqldump$ver" 'attr(0554,root,root)' \ + --file "/usr/bin/mysqlimport$ver" 'attr(0554,root,root)' \ + --file "/usr/bin/mysqlshow$ver" 'attr(0554,root,root)' \ | grep -vE '/home/e-smith/db/mysql$' \ > %{name}-%{version}-filelist-mariadb$ver echo "%doc COPYING" >> %{name}-%{version}-filelist-mariadb$ver @@ -271,6 +327,7 @@ Group: Database Requires: rh-mariadb103 Requires: rh-mariadb103-mariadb Requires: rh-mariadb103-mariadb-server +Requires: rh-mariadb103-mariadb-server-utils BuildRequires: e-smith-devtools >= 1.13.1-03 %description -n smeserver-mariadb103 @@ -286,8 +343,9 @@ Group: Database Requires: rh-mariadb105 Requires: rh-mariadb105-mariadb Requires: rh-mariadb105-mariadb-server +Requires: rh-mariadb105-mariadb-server-utils BuildRequires: e-smith-devtools >= 1.13.1-03 - +Requires: smeserver-mysql >= 2.7.0-5 %description -n smeserver-mariadb105 Koozali SME Server configuration package for mariadb105 RH SCLo @@ -299,15 +357,71 @@ Koozali SME Server configuration package %changelog +* Sun Sep 01 2024 Jean-Philippe Pialasse 2.7.0-19.sme +- backup user privileges in separate file [SME: 12145] + this will allow mariadb 10.3 and higher migration + and is needed to restore to SME 11 + +* Thu Nov 23 2023 Jean-Philippe Pialasse 2.7.0-18.sme +- fix OpenFilesLimit too low preventing backup [SME: 12417] +- deleting extra folder in /home/e-smith/db/mysql/ for mariadb10* + +* Sun Dec 11 2022 Jean-Philippe Pialasse 2.7.0-17.sme +- fix mariadb overriding skip-networking for other versions [SME: 12262] + +* Mon Jul 11 2022 Jean-Philippe Pialasse 2.7.0-16.sme +- use dedicated log file for *mysql.init [SME: 11953] + +* Tue Jun 07 2022 John Crisp 2.7.0-15.sme +- Fix init for MariaDB 104+ [SME:11991] + +* Sun Apr 10 2022 Jean-Philippe Pialasse 2.7.0-14.sme +- /usr/libexec/mysql-wait-stop not used after mariadb101 [SME: 11936] + +* Sat Apr 09 2022 Jean-Philippe Pialasse 2.7.0-13.sme +- fix few typos [SME: 11936] + +* Sat Apr 02 2022 Jean-Philippe Pialasse 2.7.0-12.sme +- remove SourcePath from mysql-init service file [SME: 11922] + +* Wed Mar 16 2022 Jean-Philippe Pialasse 2.7.0-11.sme +- fix mariadb*-mysql.init path in service file [SME: 11899] + +* Wed Mar 16 2022 Jean-Philipe Pialasse 2.7.0-10.sme +- fix sclo metadata path for sql/init templated scripts [SME: 11899] + +* Wed Mar 16 2022 Jean-Philipe Pialasse 2.7.0-8.sme +- missing sockets for backup of db [SME: 11899] + +* Mon Mar 14 2022 Jean-Philippe Pialasse 2.7.0-7.sme +- adding requirement for mariadb-server-utils (105 and 103) [SME: 11899] + +* Mon Mar 14 2022 Jean-Philippe Pialasse 2.7.0-6.sme +- fix password for mariadb 105 [SME: 11899] + +* Sun Mar 13 2022 Jean-Philippe Pialasse 2.7.0-5.sme +- fix typo in socket, seen with phpmyadmin [SME: 11899] +- fix permissions for mariadb105 [SME: 11899] + create a dedicated set.password for mariadb>103 + +* Sun Mar 13 2022 Jean-Philippe Pialasse 2.7.0-3.sme +- missing phpMyAdmin fragments [SME: 11899] + +* Sun Mar 13 2022 Jean-Philippe Pialasse 2.7.0-2.sme +- fix few sclo issues [SME: 11899] + missing +x for binaries shortcut + mariadb105 passwordless root access + mysqld_safe-scl-helper vs mysqld-scl-helper + * Fri Mar 11 2022 Jean-Philippe Pialasse 2.7.0-1.sme - prepare spec for multiple version support [SME: 11899] - package renamed from e-smith-mysql to smeserver-mysql [SME: 11897] - remove duplicate logrotate and remove unsused template [SME: 11467] - move scripts /etc/rc.d/init.d/mysql-init to /sbin/e-smith/systemd [SME: 11898] -- add rh-mariadb101 support [SME: ] -- add rh-mariadb102 support [SME: ] -- add rh-mariadb103 support [SME: ] -- add rh-mariadb105 support [SME: ] +- add rh-mariadb101 support [SME: 11901] +- add rh-mariadb102 support [SME: 11902] +- add rh-mariadb103 support [SME: 11903] +- add rh-mariadb105 support [SME: 11904] * Tue Aug 17 2021 John Crisp 2.6.0-22.sme - Remove template and set default max_allowed_packet=16M