Compare commits

...

19 Commits

Author SHA1 Message Date
2d41a90503 * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit
  remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
  add a tmp.d for pid file, add post action dnf script
  update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-12 23:12:13 -04:00
93c2c06fff * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit
  remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
  add a tmp.d for pid file, add post action dnf script
  update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-09 17:43:02 -04:00
3ee120228a * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit
  remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
  add a tmp.d for pid file, add post action dnf script
  update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-09 00:08:27 -05:00
e7a6e31905 * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit
  remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
  add a tmp.d for pid file, add post action dnf script
  update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-09 00:02:08 -05:00
de0996e198 * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit
  remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
  add a tmp.d for pid file, add post action dnf script
  update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-08 23:59:18 -05:00
040ed0e99f * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit, remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade
  add our tmp.d
  add post action dnf script
  update mariadb.service.d/  content
  set default to utfmb4
- TODO mysql.dump filtering [SME: 12592]
- TODO feedback plugin [SME: 12897]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-07 22:58:08 -05:00
afcd41481e * Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
- upgrade to support mariadb 11.4 [SME: 12930]
  move mariadb-upgrade to mysql.init unit, remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade
  add our tmp.d
  add post action dnf script
  update mariadb.service.d/  content
  set default to utfmb4
- TODO mysql.dump filtering [SME: 12592]
- TODO feedback plugin [SME: 12897]

* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-03-07 22:32:45 -05:00
34effb2c39 * Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
2025-01-26 16:13:15 -05:00
375ec52f86 Add *.bak to .gitignore 2024-11-12 19:20:39 +00:00
56d3583079 Deleting spurious *.spec.bak files 2024-11-12 19:20:37 +00:00
1b23159978 Update README with specific Bugzilla links with status options 2024-10-27 14:29:02 +00:00
2cea9d23a1 Update readme bugzilla link to show all outstanding bugs 2024-10-27 12:12:36 +00:00
671a8d6e5f * Mon Apr 08 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- add missing mysql.private folder [SME: 11856]
2024-04-08 00:28:37 -04:00
8e8cdfd86f * Sat Apr 06 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- backup users priv, plugins, udfs, servers, stats, timezones [SME: 12591]
2024-04-06 15:30:15 -04:00
c8c2aa10bd * Fri Apr 05 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.sme
- tidy spec and sources for mariadb10.5 support [SME: 12524]
- try to make compatible with higher version from mariadb repo [SME: 11856]
- fix logrotate duplicate entry [SME: 12554]

* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-3.sme
- Set license file to GPL2.0  [SME: 12577]
2024-04-06 01:01:49 -04:00
fbc84843d3 * Fri Apr 05 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-4.sme
- tidy spec and sources for mariadb10.5 support [SME: 12524]
- try to make compatible with higher version from mariadb repo [SME: 11856]
- fix logrotate duplicate entry [SME: 12554]

* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-3.sme
- Set license file to GPL2.0  [SME: 12577]
2024-04-06 00:48:58 -04:00
7e830858f7 Set license file to GPL2.0 2024-04-04 11:22:52 +01:00
75803697a4 change Requires to reference smeserver-* not e-smith-* in spec 2024-03-23 15:56:50 +00:00
4999f13133 Update 2024-03-23 12:11:54 +00:00
46 changed files with 1072 additions and 960 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.log
*spec-20*
*.tar.xz
*.bak

126
LICENSE
View File

@ -1,73 +1,119 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
1. Definitions.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
Preamble
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
The precise terms and conditions for copying, distribution and modification follow.
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
How to Apply These Terms to Your New Programs
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
Copyright [yyyy] [name of copyright owner]
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -11,7 +11,14 @@ SMEServer Koozali developed git repo for smeserver-mysql smeserver
<br />https://wiki.koozali.org/Software_Collections:MySQL
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-mysql&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
Show list of outstanding bugs:
[All](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=NEEDINFO&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&cf_package=smeserver-mysql&classification=SME+Server&list_id=105756&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=CONFIRMED&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Need info](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=NEEDINFO&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[In progress](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=IN_PROGRESS&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=RESOLVED&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=VERIFIED&cf_package=smeserver-mysql&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
## Description

View File

@ -1,3 +0,0 @@
#! /bin/sh
cd /var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql && find . -type f | xargs rm -f

View File

@ -1,3 +0,0 @@
#!/bin/sh
exec /bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/*.dump

View File

@ -1,58 +0,0 @@
#!/bin/sh
# We have to re-enable SCL environment, because /sbin/service
# clears almost all environment variables.
# Since X_SCLS is cleared as well, we lose information about other
# collections enabled.
. /opt/rh/rh-mariadb!!!VER!!!/service-environment
for sclname in $RH_MARIADB!!!VER!!!_SCLS_ENABLED ; do
. /opt/rh/$sclname/enable
export X_SCLS="$X_SCLS $sclname"
done
# we want start daemon only inside "scl enable" invocation
if ! scl_enabled $sclname ; then
echo "Collection $sclname has to be listed in /opt/rh/rh-mariadb!!!VER!!!/service-environment"
exit 1
fi
status=$(/sbin/e-smith/config getprop mariadb status)
fixtables=$(/sbin/e-smith/config getprop mariadb autofixtables || echo "disabled")
if [ "$fixtables" = "enabled" ]; then
/sbin/e-smith/config delprop mariadb failsbackup
fi
failsbackup=$(/sbin/e-smith/config getprop mariadb failsbackup || echo "disabled")
onfailure () {
db=$1
message=""
if [ "$failsbackup" = "enabled" ]; then
exit 1;
message="There was an error trying to dump database $db, please fix this db. We stop there without backups."
echo $message
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB !!!VER!!! database" admin
fi
message="$message \nThere was an error trying to dump database $db, please check for table errors in this db. Forcing a backup of the corrupted DB."
/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
if [ "$fixtables" = "enabled" ]; then
repair="failure"
message="$message \nTrying to auto-repair the db and do a backup after..."
/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqlcheck --socket=!!!SOCKET!!! -s --auto-repair -c "$db" && \
/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump && repair="success"
message="$message \n => $repair"
fi
echo $message
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB database" admin
}
if [ "$status" = "disabled" ]
then
echo "mysqld is disabled - no tables dumped" >&2
exit 0
fi
for db in $(/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql --socket=!!!SOCKET!!! -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$")
do
/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump || onfailure $db
done

View File

@ -1,17 +0,0 @@
#!/bin/sh
status=$(/sbin/e-smith/config getprop mariadb!!!VER!!!-mariadb status)
if [ "$status" = "disabled" ]
then
echo "mysqld is disabled - no tables restored" >&2
exit 0
fi
/bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/information_schema.dump
/bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/performance_schema.dump
if [ ! -f /var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql/mysql/user.frm ]
then
for db in $(ls /home/e-smith/db/mariadb!!!VER!!!/*.dump 2> /dev/null | grep -v '/mysql.dump')
do
mv $db /etc/e-smith/sql/init!!!VER!!!/01_$(basename $db .dump).sql
done
fi

View File

@ -1,5 +0,0 @@
socket=/var/lib/mysql/mariadb!!!VER!!!.sock
{
my $localonly = ${'mariadb!!!VER!!!-mariadb'}{'LocalNetworkingOnly'} || "no";
$OUT = ($localonly eq 'yes') ? "skip-networking" : "skip-networking=0\n# networking is enabled";
}

View File

@ -1,7 +0,0 @@
{
$OUT = "";
my $localonly = ${'mariadb!!!VER!!!-mariadb'}{'LocalNetworkingOnly'} || "no";
# define port
my $port = ${'mariadb!!!VER!!!-mariadb'}{'port'} || "!!!PORT!!!";
$OUT .= ($localonly eq 'yes') ? "#no port as skip-networking\n" : "port=$port\n";
}

View File

@ -1,84 +0,0 @@
/* Server Mariadb !!!VER!!! localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '!!!SOCKET!!!';
$cfg['Servers'][$i]['compress'] = false;
# standalone or login mode
$scriptname=end(explode('/',$_SERVER['PHP_SELF']));
$scriptpath=str_replace($scriptname,"",$_SERVER['PHP_SELF']);
# standalone login part
{
my $adminaccess = ($phpmyadmin{'adminaccess'} || 'enabled');
my $multiaccess = ($phpmyadmin{'multiaccess'} || 'disabled');
if (("$adminaccess" eq "enabled"))
{
$OUT .="if (\$scriptpath==\"/phpmyadmin/\" && \$_SERVER['PHP_AUTH_USER']=='admin')\n";
$OUT .="{\n";
$OUT .="\$cfg['Servers'][\$i]['auth_type'] = 'config';\n";
$OUT .="\$cfg['Servers'][\$i]['user'] = 'root';\n";
open (PW, "/etc/openldap/ldap.pw")
|| die "Could not read LDAP password.\n";
my $pw = <PW>;
chomp ($pw);
close PW;
$OUT .="\$cfg['Servers'][\$i]['password'] = '$pw';\n";
$OUT .="}";
}
else
{
$OUT .="# standelaone admin configuration disabled";
}
}
# end of standalone login part
# multiuser login part
{
my $adminaccess = ($phpmyadmin{'adminaccess'} || 'enabled');
my $multiaccess = ($phpmyadmin{'multiaccess'} || 'disabled');
$OUT .="\n";
if (("$multiaccess" eq "enabled") && ("$adminaccess" eq "enabled"))
{
$OUT .="if (\$scriptpath==\"/phpmyadmin-multi/\")\n";
$OUT .="{\n";
}
if (("$multiaccess" eq "enabled"))
{
$OUT .="\$cfg['Servers'][\$i]['auth_type'] = 'cookie';\n";
my $secret = ${'httpd-admin'}{TKTAuthSecret} || "34322500-7330-4400-423A-3A00434F5245";
$OUT .="\$cfg['blowfish_secret'] = '$secret';\n";
}
else
{
$OUT .="# multiuser disabled\n";
}
if (("$multiaccess" eq "enabled") && ("$adminaccess" eq "enabled"))
{
$OUT .="}\n";
}
}
# end of multiuser login part
$cfg['Servers'][$i]['controluser'] = "";
$cfg['Servers'][$i]['controlpass'] = "";
$cfg['Servers'][$i]['only_db'] = "";
$cfg['Servers'][$i]['hide_db'] = "";
$cfg['Servers'][$i]['verbose'] = 'Mariadb!!!VER!!!';// here is the name as it appears in phpmyadmin
$cfg['Servers'][$i]['pmadb'] = "";
$cfg['Servers'][$i]['bookmarktable'] = "";
$cfg['Servers'][$i]['relation'] = "";
$cfg['Servers'][$i]['table_info'] = "";
$cfg['Servers'][$i]['table_coords'] = "";
$cfg['Servers'][$i]['pdf_pages'] = "";
$cfg['Servers'][$i]['column_info'] = "";
$cfg['Servers'][$i]['history'] = "";
$cfg['Servers'][$i]['verbose_check'] = TRUE;
$cfg['Servers'][$i]['AllowRoot'] = TRUE;
$cfg['Servers'][$i]['AllowDeny']['order']="";
$cfg['Servers'][$i]['AllowDeny']['rules']= array();
$cfg['Servers'][$i]['AllowNoPassword']= FALSE;
$cfg['Servers'][$i]['designer_coords']= "";
$cfg['Servers'][$i]['bs_garbage_threshold']= 50;
$cfg['Servers'][$i]['bs_repository_threshold']= '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout']= 600;
$cfg['Servers'][$i]['bs_temp_log_threshold']= '32M';

View File

@ -1,17 +0,0 @@
/var/log/mariadb!!!VER!!!/*.log {
create 640 mysql mysql
notifempty
daily
rotate 7
missingok
compress
postrotate
# just if mysqld is really running
if test -x /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin && \
/usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! ping &>/dev/null
then
/usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! --local flush-error-log \
flush-engine-log flush-general-log flush-slow-log
fi
endscript
}

View File

@ -1,61 +0,0 @@
#!/usr/bin/perl -w
use strict;
use esmith::config;
use esmith::db;
use esmith::util;
my %conf;
tie %conf, 'esmith::config';
my $event = $ARGV[0];
my $file = $ARGV[1];
#---------------------------------------------------------------------------
# Check the runlevel, if we're in runlevel 7, and we're being called from
# bootstrap-console-save, then MySQL can't be running, so use bootstrap mode.
# Otherwise, just use mysql to do a straight import.
#---------------------------------------------------------------------------
my $runlevel;
open (RUNLEVEL, "-|", "/usr/bin/systemctl get-default");
(undef, $runlevel) = split(' ',<RUNLEVEL>);
close RUNLEVEL;
if ( ($runlevel ne 'multi-user.target' && $runlevel ne "sme-server.target") || $event eq 'bootstrap-console-save')
{
my $pid = open(KID, "|-");
if (defined $pid)
{
if ($pid)
{
open(SQL, "<$file");
print KID foreach (<SQL>);
close SQL;
close(KID);
waitpid $pid,0;
}
else
{
# Find our mysqld binary
my $mysqld = "/opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld";
if (-f "/opt/rh/rh-mariadb!!!VER!!!/root/usr/sbin/mysqld") {
$mysqld = "/opt/rh/rh-mariadb!!!VER!!!/root/usr/sbin/mysqld";
}
# Hard-code user, since it is set in mysqld_safe currently.
# See http://bugs.mysql.com/2163
exec("/usr/bin/scl enable rh-mariadb!!!VER!!! -- $mysqld", qw(--bootstrap --user=mysql --skip-grant-tables));
}
}
else
{
warn "Couldn't fork: $!";
}
}
else
{
system("/usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql < $file");
}
exit(0);

View File

@ -1,58 +0,0 @@
#!/bin/bash
datadir="/var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql"
# We have to re-enable SCL environment, because /sbin/service
# clears almost all environment variables.
# Since X_SCLS is cleared as well, we lose information about other
# collections enabled.
. /opt/rh/rh-mariadb!!!VER!!!/service-environment
for sclname in $RH_MARIADB!!!VER!!!_SCLS_ENABLED ; do
. /opt/rh/$sclname/enable
export X_SCLS="$X_SCLS $sclname"
done
# we want start daemon only inside "scl enable" invocation
if ! scl_enabled $sclname ; then
echo "Collection $sclname has to be listed in /opt/rh/rh-mariadb!!!VER!!!/service-environment"
exit 1
fi
if [ ! -f $datadir/mysql/user.frm ]
then
touch /var/log/mariadb!!!VER!!!/mariadb.log
chown mysql:mysql /var/log/mariadb!!!VER!!!/mariadb.log
chmod 0640 /var/log/mariadb!!!VER!!!/mariadb.log
echo "Initializing mariadb!!!VER!!! database"
/opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysql-prepare-db-dir
ret=$?
if [ $ret -ne 0 ] ; then
echo "Initialization of MySQL database failed." >&2
echo "Perhaps /etc/opt/rh/rh-mariadb!!!VER!!!/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
# set root password , 104 and above have a different syntax and allow root passwordless access
if [ !!!VER!!! -le 103 ]
then
/opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2
fi
# upgrade does not need to be run on a fresh datadir
#echo "5.7.24" >"$datadir/mysql_upgrade_info"
# In case we're running as root, make sure files are owned properly
chown -R "mysql:mysql" "$datadir"
if [ -f /home/e-smith/db/mariadb!!!VER!!!/mysql.dump ]
then
/sbin/e-smith/expand-template /etc/e-smith/sql/init!!!VER!!!/00_restore_dumped_dbs
fi
else
# else we set root password anyway ! just to be sure ! 104 and above have a different syntax and allow root passwordless access
if [ !!!VER!!! -le 103 ]
then
/opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2
fi
exit 0
fi

View File

@ -1,82 +0,0 @@
#!/bin/sh
#----------------------------------------------------------------------
# copyright (C) 2022 Koozali Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Technical support for this program is available from Mitel Networks
# Please visit our web site www.mitel.com/sme/ for details.
#----------------------------------------------------------------------
# We have to re-enable SCL environment, because /sbin/service
# clears almost all environment variables.
# Since X_SCLS is cleared as well, we lose information about other
# collections enabled.
. /opt/rh/rh-mariadb!!!VER!!!/service-environment
for sclname in $RH_MARIADB!!!VER!!!_SCLS_ENABLED ; do
. /opt/rh/$sclname/enable
export X_SCLS="$X_SCLS $sclname"
done
# we want start daemon only inside "scl enable" invocation
if ! scl_enabled $sclname ; then
echo "Collection $sclname has to be listed in /opt/rh/rh-mariadb!!!VER!!!/service-environment"
exit 1
fi
# Source function library.
. /etc/rc.d/init.d/functions
if [ $# -lt 1 ]; then
echo "Usage: $0 <start|restart>" 1>&2
exit 1
fi
# We should only do something if $1 is 'start'.
if [ $1 != "start" ] && [ $1 != "restart" ]; then
exit 0
fi
for i in $(seq 1 10)
do
if test -e !!!SOCKET!!!
then
exit_value=0
HOME=/root
export HOME
for link in $(find /etc/e-smith/sql/init!!!VER!!! -type f -o -type l | sort)
do
F=$(basename $link | sed s/S[0-9][0-9]//)
case $F in
*.sql)
action "Loading $F into mariadb !!!VER!!!" /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql --socket=!!!SOCKET!!! < $link && /bin/rm $link
;;
*)
action "Loading $F into mariadb !!!VER!!!" $link && /bin/rm $link
;;
esac
# Record any failure for the final return value.
if [ $? -ne 0 ]; then
exit_value=1
fi
done
exit $exit_value
fi
echo "Waiting for mysql to startup" >&2
sleep 2
done
exit 1

View File

@ -1,53 +0,0 @@
[Unit]
Description=Mariadb !!!VER!!! database server
After=syslog.target
After=network.target
[Service]
Type=simple
User=root
Group=root
PIDFile=/var/run/rh-mariadb!!!VER!!!-mariadb/mariadb.pid
# Load collections set to enabled for this service
EnvironmentFile=/opt/rh/rh-mariadb!!!VER!!!/service-environment
#ours : we need root user as + and ! are not yet supported
ExecStartPre=-/sbin/e-smith/service-status mariadb!!!VER!!!-mariadb
ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql/set.password
ExecStartPre=-/sbin/e-smith/expand-template /root/.my.cnf
ExecStartPre=-/sbin/e-smith/expand-template /etc/my.cnf
ExecStartPre=-/sbin/e-smith/expand-template /etc/opt/rh/rh-mariadb!!!VER!!!/my.cnf
ExecStartPre=/sbin/e-smith/systemd/mariadb!!!VER!!!-initialize
# We want to start server only inside "scl enable" invocation
ExecStartPre=/usr/bin/scl enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mariadb!!!VER!!!
ExecStartPre=/usr/bin/scl enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysql-check-socket
ExecStartPre=/usr/bin/scl enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysql-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=/opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld_safe-scl-helper enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld \
--defaults-file=/etc/my.cnf \
--datadir=/var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql \
--user=mysql \
--basedir=/opt/rh/rh-mariadb!!!VER!!!/root/usr \
--pid-file=/var/run/rh-mariadb!!!VER!!!-mariadb/mariadb.pid
ExecStartPost=/usr/bin/scl enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysql-check-upgrade
ExecStopPost=/usr/bin/scl enable $RH_MARIADB!!!VER!!!_SCLS_ENABLED -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysql-wait-stop
#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
Restart=on-failure
RestartPreventExitStatus=1
[Install]
WantedBy=sme-server.target

View File

@ -1,20 +0,0 @@
[Unit]
SourcePath=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init
Description=Koozali SME Server mysql DB injector for mariadb!!!VER!!!
After=mariadb!!!VER!!!-mariadb.service
Requires=mariadb!!!VER!!!-mariadb.service
[Service]
Type=oneshot
Restart=no
TimeoutSec=10min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init start
ExecStop=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init stop
[Install]
WantedBy=sme-server.target

View File

@ -1,7 +1,21 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
my @versions = ( 101, 102, 103, 105);
# we add few link fromn old mysql things to mariadb things
safe_symlink("/usr/bin/mariadb-dump","root/usr/bin/mysqldump");
safe_symlink("/usr/bin/mariadb-dumpslow","root/usr/bin/mysqldumpslow");
safe_symlink("/usr/bin/mariadb-check","root/usr/bin/mysqlcheck");
safe_symlink("/usr/bin/mariadb-admin","root/usr/bin/mysqladmin");
safe_symlink("/usr/bin/mariadb-show","root/usr/bin/mysqlshow");
safe_symlink("/usr/bin/mariadb-upgrade","root/usr/bin/mysql_upgrade");
safe_symlink("/usr/bin/mariadb","root/usr/bin/mysql");
safe_symlink("/usr/bin/mariadb-access","root/usr/bin/mysqlaccess");
safe_symlink("/usr/bin/mariadb-binlog","root/usr/bin/mysqlbinlog");
safe_symlink("/usr/bin/mariadb-convert-table-format","root/usr/bin/mysql_convert_table_format");
safe_symlink("/usr/bin/mariadb-find-rows","root/usr/bin/mysql_find_rows");
safe_symlink("/usr/bin/mariadb-fix-extensions","root/usr/bin/mysql_fix_extensions");
#--------------------------------------------------
# pre-backup actions
@ -11,12 +25,6 @@ my $event = "pre-backup";
event_link("mysql-delete-dumped-tables", $event, "10");
event_link("mysql-dump-tables", $event, "20");
foreach ( @versions)
{
event_link("mariadb$_-delete-dumped-tables", $event, "10");
event_link("mariadb$_-dump-tables", $event, "20");
}
#--------------------------------------------------
# post-backup actions
#--------------------------------------------------
@ -25,12 +33,6 @@ $event = "post-backup";
# Probably don't really need to do this
event_link("mysql-delete-dumped-tables", $event, "10");
foreach ( @versions)
{
event_link("mariadb$_-delete-dumped-tables", $event, "10");
}
# When we do a restore, we want to start from a completely clean slate
$event = "pre-restore";
@ -38,13 +40,6 @@ safe_symlink("stop", "root/etc/e-smith/events/$event/services2adjust/mariadb");
# Needs to be after shutdown of mysqld
event_link("mysql-delete-db-files", $event, "99");
foreach ( @versions)
{
safe_symlink("stop", "root$_/etc/e-smith/events/$event/services2adjust/mariadb$_-mariadb");
event_link("mariadb$_-delete-db-files", $event, "99");
}
#--------------------------------------------------
# actions for bootstrap-console-save event
#--------------------------------------------------
@ -53,7 +48,7 @@ $event = "bootstrap-console-save";
foreach (qw(
/etc/my.cnf
/root/.my.cnf
/var/lib/mysql/set.password
/var/lib/mysql.private/set.password
))
{
templates2events("$_", $event);
@ -61,16 +56,8 @@ foreach (qw(
# Move all database dumps except for mysql.dump to sql/init
event_link("mysql-load-tables", $event, "40");
templates2events("/etc/e-smith/sql/init/10mysql_upgrade", $event);
foreach ( @versions)
{
templates2events("/etc/opt/rh/rh-mariadb$_/my.cnf", $event);
templates2events("/etc/e-smith/sql/init$_/10mysql_upgrade", $event);
event_link("mariadb$_-load-tables", $event, "40");
}
#--------------------------------------------------
# actions for timezone-update event
#--------------------------------------------------
@ -78,11 +65,6 @@ $event = "timezone-update";
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb");
foreach ( @versions)
{
safe_symlink("restart", "root$_/etc/e-smith/events/$event/services2adjust/mariadb$_-mariadb");
}
#--------------------------------------------------
# actions for smeserver-mysql-update event
#--------------------------------------------------
@ -91,7 +73,7 @@ $event = "smeserver-mysql-update";
foreach (qw(
/etc/my.cnf
/root/.my.cnf
/var/lib/mysql/set.password
/var/lib/mysql.private/set.password
))
{
templates2events("$_", $event);
@ -102,30 +84,10 @@ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.in
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog");
# Move all database dumps except for mysql.dump to sql/init
event_link("mysql-load-tables", $event, "40");
templates2events("/etc/e-smith/sql/init/10mysql_upgrade", $event);
templates2events("/etc/rsyslog.conf", $event);
# systemd-specific action mandatory for this package-update event
event_link("systemd-reload", $event, "89");
event_link("systemd-default", $event, "88");
foreach ( @versions)
{
$event = "smeserver-mariadb$_-update";
templates2events("/etc/my.cnf", $event);
templates2events("/root/.my.cnf", $event);
templates2events("/var/lib/mysql/set.password", $event);
templates2events("/var/lib/mysql/set.password2", $event);
templates2events("/etc/phpMyAdmin/config.inc.php", $event);
templates2events("/etc/opt/rh/rh-mariadb$_/my.cnf", $event);
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb$_-mariadb");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb$_-mysql.init");
event_link("mariadb$_-load-tables", $event, "40");
templates2events("/etc/e-smith/sql/init$_/10mysql_upgrade", $event);
# systemd-specific action mandatory for this package-update event
event_link("systemd-reload", $event, "89");
event_link("systemd-default", $event, "88");
}

View File

@ -0,0 +1,2 @@
mariadb*:any:/sbin/e-smith/signal-event smeserver-mysql-update
MariaDB*:any:/sbin/e-smith/signal-event smeserver-mysql-update

View File

@ -1,6 +1,6 @@
{
# InnoDB is mandatory with mariadb
my $a = $DB->get("mariadb") or return;
return unless (exists $mariadb{'InnoDB'});
$DB->get_prop_and_delete('mariadb', 'InnoDB');
$DB->get_prop_and_delete('mariadb', 'InnoDB') if (exists $mariadb{'InnoDB'});
$DB->get_prop_and_delete('mariadb', 'innodb_file_format') if (exists $mariadb{'innodb_file_format'});
}

View File

@ -1,3 +1,3 @@
#! /bin/sh
[ "$1" = "pre-restore" ] || exit 0
cd /var/lib/mysql && find . -type f | xargs rm -f

View File

@ -39,3 +39,15 @@ for db in $(mysql -BNre "show databases;"|egrep -vi "^information_schema$|^perfo
do
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
done
# dump user privileges
mysqldump --system=users --insert-ignore > /home/e-smith/db/mysql/mysql.privileges.dump
# dump plugins
mysqldump --system=plugins --insert-ignore > /home/e-smith/db/mysql/mysql.plugins.dump
# dump udfs
mysqldump --system=udfs --insert-ignore > /home/e-smith/db/mysql/mysql.udfs.dump
# dump servers
mysqldump --system=servers --insert-ignore > /home/e-smith/db/mysql/mysql.servers.dump
# dump stats
mysqldump --system=stats --insert-ignore > /home/e-smith/db/mysql/mysql.stats.dump
# dump timezones
mysqldump --system=timezones --insert-ignore > /home/e-smith/db/mysql/mysql.timezones.dump

View File

@ -10,7 +10,7 @@ fi
/bin/rm -f /home/e-smith/db/mysql/performance_schema.dump
if [ ! -f /var/lib/mysql/mysql/user.frm ]
then
for db in $(ls /home/e-smith/db/mysql/*.dump 2> /dev/null | grep -v '/mysql.dump')
for db in $(ls /home/e-smith/db/mysql/*.dump 2> /dev/null | grep -v '/mysql.dump'| grep -v '/mysql.privileges.dump')
do
mv $db /etc/e-smith/sql/init/01_$(basename $db .dump).sql
done

View File

@ -1,3 +0,0 @@
PERMS=0400
UID="root"
GID="root"

View File

@ -1,15 +1,18 @@
#! /bin/sh
( cat /home/e-smith/db/mysql/mysql.dump ;
cat /var/lib/mysql/set.password ) | mysql || exit 1
/usr/bin/mysql_upgrade
/bin/rm /var/run/mariadb/mariadb.pid
# we need to filter out mysql.user table from older mariadb and from mysql
# in SME10 we added for migration creation of mysql.privileges.dump with mariadb 10.5 and newer syntax
( /usr/bin/mysql_filter_user_table /home/e-smith/db/mysql/mysql.dump ;
[ -f /home/e-smith/db/mysql/mysql.privileges.dump ] && cat /home/e-smith/db/mysql/mysql.privileges.dump;
cat /var/lib/mysql.private/set.password ) | mysql || exit 1
/bin/rm /run/mariadb/mariadb.pid
/usr/bin/systemctl restart mariadb.service
for i in $(seq 1 20);
do
if [ -f /var/run/mariadb/mariadb.pid ]
if [ -f /run/mariadb/mariadb.pid ]
then
/bin/rm /home/e-smith/db/mysql/mysql.dump
[ -f /home/e-smith/db/mysql/mysql.privileges.dump ] /bin/rm /home/e-smith/db/mysql/mysql.privileges.dump
exit 0
fi
echo waiting for mysqld to restart

View File

@ -1,16 +0,0 @@
#!/bin/sh
/usr/bin/mysql_upgrade
/bin/rm /var/run/mariadb/mariadb.pid
/usr/bin/systemctl restart mariadb.service
for i in $(seq 1 20);
do
if [ -f /var/run/mariadb/mariadb.pid ]
then
exit 0
fi
echo waiting for mysqld to restart
sleep 1
done
echo mysqld failed to restart
exit 1

View File

@ -0,0 +1,3 @@
[client]
default-character-set = utf8mb4

View File

@ -0,0 +1,3 @@
[mysql]
default-character-set = utf8mb4

View File

@ -0,0 +1,11 @@
{
# starting mariadb 10.6 , utf8 changes to utf8mb3 (as utf8 used to be an alias of utfmb3)
# utf8 will soon be an alias of utf8mb4, and more and mroe db are demanding utf8mb4
# so we are better default to it in 2025.
# old-mode will force utf8mb3 for character-set-system
}
character-set-client-handshake = FALSE
collation-server = utf8mb4_unicode_ci
init-connect = 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'
character-set-server = utf8mb4
old-mode = ''

View File

@ -1 +1 @@
pid-file=/var/run/mariadb/mariadb.pid
pid-file=/run/mariadb/mariadb.pid

View File

@ -1,14 +1,5 @@
#innodb
{# https://mariadb.com/kb/en/innodb-system-variables/#innodb_large_prefix
#default Off up to 10.2.1
# removed in 10.3.1 and 10.6.0
# keep it there up to 10.2.2
}innodb_large_prefix=1
{#https://mariadb.com/kb/en/innodb-system-variables/#innodb_file_format
# default is antelope up to 10.2.1
# keep it up to 10.2.2
}innodb_file_format={ $mariadb{'innodb_file_format'}||'barracuda' }
{# enabled is already the default
}innodb_file_per_table={ $mariadb{'innodb_file_per_table'}||'1' }

View File

@ -1,4 +1,2 @@
{ # allow backwards-compatibility with safe_mysqld (mysql < 4.0)
-f "/usr/bin/mysqld_safe" ? "[mysqld_safe]" : "[safe_mysqld]";
}
[mysqld_safe]

View File

@ -1,14 +1,4 @@
# *-mysql.init
:programname, isequal, "mysql.init" /var/log/mysql.init/mysql.init.log
& stop
:programname, isequal, "mariadb105-mysql.init" /var/log/mysql.init/mariadb105-mysql.init.log
& stop
:programname, isequal, "mariadb103-mysql.init" /var/log/mysql.init/mariadb103-mysql.init.log
& stop
:programname, isequal, "mariadb102-mysql.init" /var/log/mysql.init/mariadb102-mysql.init.log
& stop
:programname, isequal, "mariadb101-mysql.init" /var/log/mysql.init/mariadb101-mysql.init.log
& stop
:programname, isequal, "mysql57-mysql.init" /var/log/mysql.init/mysql57-mysql.init.log
& stop

View File

@ -1,12 +0,0 @@
{
use esmith::util;
my $pw = esmith::util::LdapPassword();
$OUT .= "use mysql;\n";
$OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n";
$OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n";
$OUT .= "DELETE FROM db WHERE user='';\n";
$OUT .= "DELETE FROM user WHERE user='';\n";
$OUT .= "FLUSH PRIVILEGES;\n";
}

View File

@ -1,17 +0,0 @@
/var/log/mariadb/*.log {
create 640 mysql mysql
notifempty
daily
rotate 3
missingok
compress
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-logs
fi
endscript
}

View File

@ -3,12 +3,9 @@
exec 2>&1
if [ ! -f /var/lib/mysql/mysql/user.frm ]
then
setuidgid mysql sh /usr/bin/mysql_install_db
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < /var/lib/mysql/set.password
setuidgid mysql sh /usr/bin/mysql_install_db --rpm --skip-test-db --user=mysql --group=mysql
if [ -f /home/e-smith/db/mysql/mysql.dump ]
then
/sbin/e-smith/expand-template /etc/e-smith/sql/init/00_restore_dumped_dbs
fi
else
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < /var/lib/mysql/set.password
fi

View File

@ -2,13 +2,13 @@
for i in $(seq 1 20);
do
if [ -S !!!SOCKET!!! ]
if [ -S /var/lib/mysql/mysql.sock ]
then
/usr/bin/mysql!!!VER!!! < /var/lib/mysql/set.password2
/usr/bin/mysql < /var/lib/mysql.private/set.password
echo "root password set"
exit 0
fi
echo waiting for rh-mariadb105-mariadb to start to set root password
echo waiting for mariadb to start to set root password
sleep 1
done
echo failed to set root password

View File

@ -65,7 +65,7 @@ do
done
exit $exit_value
fi
echo "Waiting for mysql to startup" >&2
echo "Waiting for mariadb to startup" >&2
sleep 2
done

View File

@ -0,0 +1,830 @@
#!/bin/env bash
#
# Filter the given tables out of a MySQL/MariaDB dump file.
#
#
# The MIT License (MIT)
#
# Copyright © 2023 metaworx resonare rüegg, Martin Rüegg, Switzerland. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software. All redistributions must retain an intact copy of this copyright notice and disclaimer.
#
# Distributions of all or part of the Software intended to be used by the recipients as they would use the unmodified
# Software, containing modifications that substantially alter, remove, or disable functionality of the Software, outside
# of the documented configuration mechanisms provided by the Software, shall be modified such that the Original Author's
# bug reporting email addresses and urls are either replaced with the contact information of the parties responsible for
# the changes, or removed entirely.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mysql_filter_tables()
{
local version='mysql_filter_tables v1.4.5' url='https://gist.github.com/martin-rueegg/e247d99cc7402a4f1456c059c5d050ac';
local help_condensed='
Usage:
mysql_filter_tables [option] [exclude ...] # Use % as wildcard (use "%%" for "%")
mysql_filter_tables info-option # Print info and exit
Options:
-s|--show show generated sed command, rather than executing it
-i|--input file read from file, rather than standard input
-o|--output file write result to file, rather than standard output
-f|--force overwrite output file, if exists
-u|-ui|--unzip unzip input stream. Use with -i to read from file
-z|-zo|--zip zip ouput stream. Use with -o to write to file
-g|-gi|--gunzip gunzip input stream. Use with -i to read from file
-G|-go|--gzip gzip ouput stream. Use with -o to write to file
-h show this help
-hh|--help show more help
-V|--version show version
-1|--one-line [-m] show a one-liner that can be easily used in other scripts.
--copyright|--credits|--license|--changelog
Use --help for more information.
Use --credits for copyright, license, and credits.
';
local help='
Filter the given tables out of a MySQL/MariaDB dump file.
Accepts a list of tables to exclude (case-insensitive).
Eg. $ mysql_filter_tables "%session%" "action_log" "%_cache"
removes both one-line inserts, as well as blocks like the following:
# INSERT INTO `log` (`id`, `data`)
# VALUES
# (1,'"'"'The log content'"'"'),
# (2,'"'"'The log content'"'"');
Usage:
mysql_filter_tables [cmd-option] [exclude ...] # Filter stream
mysql_filter_tables info-option # Print info and exit
Arguments:
exclude:
- a plain table name
- a table name pattern, using % as wildcard (use "%%" for "%")
If no argument is given, the stream is simply cat through.
Options:
Command Options:
-s
--show
show generated sed command, rather than executing it.
-i
--input file
read from file, rather than standard input
-o
--output file
write result to file, rather than standard output
-f
--force
overwrite output file, if exists
-u
-ui
--unzip
unzip input stream. Use with -i to read from file
-z
-zo
--zip
zip ouput stream. Use with -o to write to file
-g
-gi
--gunzip
gunzip input stream. Use with -i to read from file
-G
-go
--gzip
gzip ouput stream. Use with -o to write to file
Info Options:
-h show usage help only
-hh|--help show this help
-V|--version show version
-1|--one-line [-m] show a one-liner that can be easily used in other scripts.
(Does not support any info options, except -V;
add -m to get a minimal version, not supporting long options)
--copyright show copyright, license, and credits
--credits show copyright, license, and credits
--license show copyright, license, and credits
--changelog show change log
Examples:
Show what will be filtered:
$ mysql_filter_tables --show log
$ mysql_filter_tables --show "%session%" "action_log" "%_cache"
$ mysql_filter_tables --show -- "-h" # in case your table name is "-h"
Usage with plain SQL file:
$ mysql_filter_tables log <big.sql >clean.sql
$ cat big.sql | mysql_filter_tables log >clean.sql
Import plain SQL dump into mysql:
$ MYSQL_PWD=secret mysql_filter_tables -i big.sql "%_cache" | mysql -u user -D database
If source is compressed:
$ mysql_filter_tables -i big.sql.zip --unzip -o clean.sql "%session%" "%_cache"
$ mysql_filter_tables -i big.sql.gz --gunzip -o clean.sql "%session%" "%_cache"
Installation:
1. Download file from github.com
$ wget '"$url"'/raw/mysql_filter_tables.sh
2.a) Source the file, and then use the function in the shell:
$ source mysql_filter_tables.sh
$ mysql_filter_tables --help
2.b) Mark the file executable und use it as script
$ chmod a+x mysql_filter_tables.sh
$ ./mysql_filter_tables.sh --help
Dependencies:
- `bash`
- `sed`, `cat`
- `zip`, `funzip`
- `gzip`, `zcat`
Note:
This is experiential software. Use at your own risk. Double-check the output
before importing it into a database. Keep the original as backup!
It is recommended to use --ignore-table=tablename with mysqldump, rather than
piping the output of mysqldump into mysql_filter_tables.
Run with --credits for copyright, license, and credits.
Run with -h for condensed usage help
';
local credits='
Copyright © 2023 metaworx resonare rüegg, Martin Rüegg, Switzerland. All Rights Reserved.
Author:
Martin Rüegg https://stackoverflow.com/users/3102305/martin-r%c3%bcegg
'"$url"'
Credits:
feskr https://stackoverflow.com/users/1180123/feskr
https://stackoverflow.com/a/51981034
dgo https://stackoverflow.com/users/508276/dgo
https://stackoverflow.com/a/53008691
duzun https://stackoverflow.com/users/1242333/duzun
https://stackoverflow.com/a/56988251
julesezaar https://stackoverflow.com/users/5418514/julesezaar
https://stackoverflow.com/a/56988251
user5754163 https://stackoverflow.com/users/5754163/user5754163
https://stackoverflow.com/a/34642589/3102305
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software. All redistributions must retain an intact copy of this copyright notice and disclaimer.
Distributions of all or part of the Software intended to be used by the recipients as they would use the unmodified
Software, containing modifications that substantially alter, remove, or disable functionality of the Software, outside
of the documented configuration mechanisms provided by the Software, shall be modified such that the Original Author'"'"'s
bug reporting email addresses and urls are either replaced with the contact information of the parties responsible for
the changes, or removed entirely.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
';
local changelog='
v1.3.7 2023-10-22
Initial public version
v1.4.5 2023-10-23
- Enh: Add options: -s, -hh, --changelog
- Enh: for --one-line, add -m option for [minimal] version, and -d option, for debugging
- Enh: Print command by default. --show will _only_ print, while --quiet will _only_ execute.
- Enh: Show error for _any_ unsupported option. -- is now required, if the first table name starts with a dash
- Fix: script would fail if no table name, but input/output options where provided
- Fix: use funzip, rather than unzip
v1.4.5-1 2025-03-08
- remove create table for the filter
- do not change existing create lines
';
e()
{
echo "$@"
}
main()
{
if (( $# == 0 )); then
# no need for further argument detection. Just cat through ... :-)
e "# $version: \$ cat" >&2
cat
fi
err()
{
e;
e "$version";
e;
printf "ERROR: $@";
e "$help_condensed";
} >&2
not_implemented()
{
err "$@ not implemented"
}
case "$1" in
-h)
e;
e "$version";
e "$help_condensed";
return 1;
;;
-hh | --help)
e;
e "$version";
e "$help";
return 1;
;;
-V | --version)
e "$version";
return 1;
;;
-1)
shift;
create_one_liner "$@";
return;
;;
--license | --copyright | --credits)
e;
e "$version";
e "$credits";
return 1;
;;
--changelog)
e;
e "$version";
e "$changelog";
return 1;
;;
esac
local -a pre p post
local f i o ex="--quiet and --show are mutually exclusive!"
local -i x=0
while [ -n "$1" ];
do
case "$1" in
--)
shift;
break;
;;
# check if the generated command should be printed, rather than executed
-s | --show)
(($x != 0)) && err "$ex" && return 5
# disable execution
x=-1;
# close file descriptors, if they've been opened already
[ -n "$i" ] && exec 4<&-;
[ -n "$o" ] && exec 5>&-;
;;
-q | --quiet)
(($x != 0)) && err "$ex" && return 5
# disable command print
x=1;
;;
-f | --force)
f=f;
;;
# redirect input from a file
-i | --input)
shift;
# check if file exists
[ ! -r "$1" ] \
&& err "File '$1' is not readable!" \
&& return 3;
i="<'$1' ";
# redirect from file
exec 4<"$1";
;;
# redirect output to file
-o | --output)
shift;
# check if file exists
[ -z "$f" -a -e "$1" ] \
&& err " File '$1' already exists! Remove file or use --force." \
&& return 4;
# redirect to file
o=">'$1'";
exec 5>"$1";
;;
# redirect output to file
-u | -ui | --unzip)
exec 0<&0;
pre=(funzip);
;;
# gunzip input
-g | -gi | --gunzip)
exec 0<&0;
pre=(zcat);
;;
# gzip output
-G | -go | --gzip)
post=(gzip --to-stdout);
;;
# zip output
-z | -zo | --zip)
post=(zip --quiet);
;;
-*)
not_implemented "$1";
return 2;
;;
*)
break;
;;
esac;
shift;
done;
if(($#!=0)); then
# T => tables; t => table
local T t;
for t in "$@";
do
T="$T|$(e "$t"| sed -E '
# trim
s/^[[:space:]]*//; s/[[:space:]]*$//;
# replace
# - "%" with "[^`]*", unless preceded by another "%"
s/(^|[^%])%([^%]|$)/\1[^\`]\*\2/g;
# - "%%" with "%", and ...
s/%%/%/g;
# - escape special characters "[", "]", "[", "|", "(", and ")" with "\"
s/([][|()])/\\\1/g
')";
done;
T=${T:1};
# For the given tables (or table patterns), do the following in the input stream:
p=(sed -E '
# 1. Delete all lines between and including
# a) "LOCK TABLES `table` WRITE;" and "UNLOCK TABLES" (which is used if for multi-line inserts
/LOCK TABLES `('"$T"')` WRITE;/,/^UNLOCK TABLES/d;
# b) "INSERT INTO `table`", or
# "REPLACE INTO `table`" that both _do not_ end with a semicolon [;]
# and a line that _does_ end on ");"
/^(INSERT|REPLACE)( (DELAYED|IGNORE))* INTO.*[)][^;]$/,/[)];$/d;
# 2. Delete all lines starting with
# a) "DROP TABLE `table`"
# b) "TRUNCATE TABLE `table`"
# c) "INSERT INTO `table`"
# d) "REPLACE INTO `table`"
# e) "UPDATE `table`"
/^((INSERT|REPLACE)( (DELAYED|IGNORE))* INTO|UPDATE( IGNORE)?|(DROP|TRUNCATE) TABLE( IF EXISTS)?) `('"$T"')`/d;
# 3. dumping "CREATE `table`"
/^-- Table structure for table `'"$T"'`/,/^-- Dumping data for table `'"$T"'`/d;
# 4. Replaces regular "CREATE TABLE" with "CREATE TABLE IF NOT EXISTS"
#REM s/^CREATE TABLE `/CREATE TABLE IF NOT EXISTS `/g
');
# Note:
# - the above 'INSERT INTO' may be followed by one or both DELAYED and IGNORE keywords
# - the above 'DROP TABLE' may be followed by 'IF EXISTS'
# cleanup pattern if it's being printed
p[2]="$(e "${p[2]}"|sed -E '
# remove leading space
s/^[[:space:]]*//;
# remove trailing spaces
s/[[:space:]]*$//;
# remove comments
/^#/d;
# remove empty lines
/^$/d;
'|sed '
# join lines
:a;/$/{N;s/\n//;ba}
')";
elif ((${#pre[@]}>0)); then
p=("${pre[@]}");
pre=()
elif ((${#post[@]}>0)); then
p=("${post[@]}");
post=()
else
p=(cat);
fi;
# redirect input to fd 4, if no input file is used
[ -z "$i" ] && exec 4<&0;
# redirect fd 5 to output, if no output file is used
[ -z "$o" ] && exec 5>&1;
x()
{
(($x <= 0)) && e "# $version: \$ $@" >&2
}
f()
{
# filter out known errors that are irrelevant
grep -v 'funzip error: invalid compressed data--length error' >&2
}
case $(( ((${#pre[@]} != 0)) + (2*((${#post[@]} != 0))))) in
0)
x "${p[@]}" "$i"$o
(($x >= 0)) && "${p[@]}" <&4 >&5 2> >(f);
;;
1)
x "${pre[@]}" '<&4|' "${p[@]} $o"
(($x >= 0)) && "${pre[@]}" <&4 2> >(f) | "${p[@]}" >&5 2> >(f);
;;
2)
x "${p[@]}" "$i"'|' "${post[@]}" $o
(($x >= 0)) && "${p[@]}" <&4 2> >(f) | "${post[@]}" >&5 2> >(f);
;;
3)
x "${pre[@]}" "$i"'|' "${p[@]}" '|' "${post[@]}" $o
(($x >= 0)) && "${pre[@]}" <&4 2> >(f) | "${p[@]}" | "${post[@]}" >&5 2> >(f);
;;
esac
# close file descriptors
exec 4<&-;
exec 5>&-;
} # main
create_one_liner()
{
local regex_cleanup_help_and_credits='
## regex_cleanup_help_and_credits
# remove help, help_condensed, credits variables
/^[[:space:]]*local (help|help_condensed|credits|changelog)=/,/^'"'"';$/d;
# remove "help" from err calls
s/^[[:space:]]*e "[$]help_condensed";?/e;e;e "Usage:";e " See $url";e;/;
# replace "$help_condensed" variable
#/^[[:space:]]*local (help_condensed)=/,/^'"'"';$/c\
#local help_condensed='"'"'\n\nUsage:\n See '"$url"'\n\n'"'"';
'
local regex_remove_condensed='
## regex_remove_condensed
# remove function "create_one_liner"
/^ function (create_one_liner)/,/^ };$/d;
# and it"s corresponding call
s/^([[:space:]]*)create_one_liner[[:space:]]+(.*);?$/\1not_implemented -1 \2/
'
local regex_cleanup_regex='
## regex_cleanup_regex
# for all lines between the beginning of the sed call and the end of its argument ...
/[ ()|]sed[[:space:]]+[^'"'"']*'"'"'/{
:join-line-and-strip-comment
# join with next line
N;
# check if newline is followed by quote, which would mark the last line
# in this case, place the newline _outside_ of the closing quote
s/(\n[[:space:]]*)('"'"')/\2>REGEX<\1/;
# if found, got to :last-line
t last-line;
:strip-comment
# strip leading spaces and comments (note: "#n" is _not_ a comment!)
s/;?\n[[:space:]]*#($|[^n].*|n[ ;])//;
# if found, do it again (from :join-line-and-strip-comment)
t join-line-and-strip-comment;
# strip trailing spaces
s/[[:space:]]+$//;
# strip leading spaces
s/;?\n[[:space:]]*(.*)$/;\1/;
# if found (which should always happen), do it again (from :join-line-and-strip-comment)
t join-line-and-strip-comment;
:last-line
# prepend opening quote with >REGEX< and place it on new line
s/([ ()|]sed[[:space:]]+[^'"'"']*)'"'"';?/\1\n>REGEX<'"'"'/;
# save pattern space to memory
h;
#l; # prints the pattern space for debbugging
# remove last line
s/(.*)\n[^\n]*$/\1/
#l; # prints the pattern space for debbugging
# disable default output to avoid duplicate lines
#n
# print the entire pattern space (including the newlines)
p;
# reload the saved pattern space
g
# this time, remove everythign _but_ the last line
s/.*(\n[^\n]*)$/\1/
#l; # prints the pattern space for debbugging
# start over with the last line, discarding the first, now empty, line
D;
}
'
local regex_remove_main_and_whitespaces='
## regex_remove_main_and_whitespaces
# for all lines, that do not start with the >REGEX< pattern
/^>REGEX</!{
# un-wrap unneccesary main()
/^[[:space:]]*function main [(][)]/,+1d;
/^[[:space:]]*main "[$]@"/,/[}]/d;
# remove "function" keyword
s/^([[:space:]]*)function ([_[:alnum:]]+) [(][)]/\1\2()/g;
# remove regex cleaning
#/^[[:space:]]*p\[2\]=/,/'"'"'\)";/d
# rename version variable
s/([ $])version([^_[:alnum:]])/\1v\2/g;
# rename not_implemented function
s/([^_[:alnum:]])not_implemented([^_[:alnum:]])/\1ni\2/g;
# rename not_implemented function
s/gzip --to-stdout/gzip -c/;
s/zip --quiet/zip -q/;
# remove spaces around case options
s/[[:space:]]*(\|)[[:space:]]*-/\1-/g;
# remove spaces around "&&", "||", and some comparison operators
s/[[:space:]]*(\||&&|\|\||==|!=|<=|>=)[[:space:]]*/\1/g;
# remove options --license, --changelog, -1, -h, and --help
/^[[:space:]]*(--license|--changelog|-1|-h|--help)/,/^[[:space:]]*;;$/d;
# remove spaces following braces
s/([()]) +/\1/g;
# remove spaces following redirections
s/([<>]) +([^<>])/\1\2/g;
# remove before opening brackets
s/[[:space:]]*[(]/(/g;
# remove some other non-essential stuff
s/--quiet and --show are mutually exclusive!/-q or -s ?!/
}
'
local regex_join_lines='
## regex_join_lines
# join lines, except the last one
:a;/$/{$!{N;
# remove the newline where the previous line ends on a single quote or closing bracket
s/(['"'"')])[[:space:]]*\n[[:space:]]*/\1/; ty;
# replace the newline using a space, where the previous line ends on an opening curly bracket
s/[{][[:space:]]*\n[[:space:]]*/{ /; ty;
# replace the newline using a space, where the previous line ends on a continuation-backslash
s/[\]\n[[:space:]]*/ /; ty;
# join all other lines using a ;
s/[;]?\n[[:space:]]*/;/; ba;
:y;ba}};
';
local regex_cleanup_joined_lines='
# regex_cleanup_joined_lines
# cleanup function opening
#s/[{];/{ /g;
# cleanup case ;; esac
s/( |([)]))in ;/\2 in /g
s/;;;?;?/; ;; /g;
s/; ;; esac;/;esac;/g;
# cleanup do|then
s/; ?(while|do|then|else|elif);/;\1 /g;
# remove semicolon after case bracket
s/([*]|--|--?[[:alnum:]]+)[)];/\1)/g;
# remove REGEX escaping
s/;>REGEX<'"'"'|'"'"'>REGEX<;/'"'"'/g
';
local regex_minimal='
# regex_minimal
# remove long options if there is a short one
s/ -([[:alnum:]])(\|-[-[:alnum:]]+)*\)/ -\1)/g;
# remove --show
s/local -i x=0;//
s/\)x [^;]+;/)/g
s/\)\(\(\$x>=0\)\)&&/)/g
s/ ex="-q or -s \?!";/;/
s/ -s\)(([^;]+|;[^;]+)+);;//
s/ -q\)(([^;]+|;[^;]+)+);;/ -q) ;;/
#l;
#s/;/;\n/g
#l;
s/;p\[2\]=".*'"'"'\)";/;/
#l
#s/\n//g
# remove some other non-essential stuff
s/ already exists! Remove file or use --force\./!!/
s/ is not readable!/?!/
';
local regex_version_condensed='
## regex_version_condensed
# rename the function
s/mysql_filter_tables/mysql_filter_tables_condensed/g;
# append "[condensed]" to the version information
s/(local version='"'"'[^'"'"']+)/\1 [condensed]/
'
local regex_version_oneliner='
## regex_version_oneliner
# rename the function
s/mysql_filter_tables/mysql_filter_tables_one/g;
/^[[:space:]]*local version=/{
# append "[one-liner]" to the version information
s/(local version='"'"'[^'"'"']+)/\1 [one-liner]/
ta
b
:a;
n
ba
}
'
# applied to one-liner
local regex_version_minimal='
## regex_version_minimal
# rename the function
s/mysql_filter_tables_one/mysql_filter_tables_minimal/g;
# append "[minimal]" to the version information
s/(local v='"'"'[^[]+)([^'"'"']+)?/\1[minimal]/
'
local -a R=(
"$regex_remove_condensed"
"$regex_cleanup_help_and_credits"
"$regex_cleanup_regex"
"$regex_version_oneliner"
"$regex_remove_main_and_whitespaces"
"$regex_join_lines"
"$regex_cleanup_joined_lines"
);
if [ "$1" = '-c' ]; then
shift
R=(
"$regex_remove_condensed"
"$regex_cleanup_regex"
"$regex_version_condensed"
);
elif [ "$1" = '-m' ]; then
shift
R=(
"${R[@]}"
"$regex_version_minimal"
"$regex_minimal"
)
fi
local r d="$( declare -f mysql_filter_tables )";
for r in "${R[@]}"; do
d="$(e "$d" | sed -E "$r")";
[ "$1" = '-d' ] && ( e "regex:"; e "$r"; e "$d"; e;) >&2
done;
e "$d";
}; # create_one_liner
main "$@"
}; # mysql_filter_tables
# check if the file is sourced
(return 2>/dev/null)
if [ "$?" -eq "0" ]
then
echo "mysql_filter_tables installed."
else
#otherwise, just run the function!
mysql_filter_tables "$@"
fi

View File

@ -0,0 +1,2 @@
#!/bin/env bash
sed -E '/LOCK TABLES `(user)` WRITE;/,/^UNLOCK TABLES/d;/^(INSERT|REPLACE)( (DELAYED|IGNORE))* INTO.*[)][^;]$/,/[)];$/d;/^((INSERT|REPLACE)( (DELAYED|IGNORE))* INTO|UPDATE( IGNORE)?|(DROP|TRUNCATE) TABLE( IF EXISTS)?) `(user)`/d;/^-- Table structure for table `user`/,/^-- Dumping data for table `user`/d;' $1

View File

@ -4,39 +4,39 @@ After=syslog.target
After=network.target
[Service]
Type=simple
User=root
Group=root
#allow to run as root pre and post
PermissionsStartOnly=true
#reset
ExecStartPre=
ExecStartPre=/usr/bin/install -d /run/mariadb -o mysql -g mysql -m 0755
# add mariadb >=10.6 specifics
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
#ours : we need root user as + and ! are not yet supported
#ExecStartPre=/usr/libexec/mysql-check-socket
ExecStartPre=-/sbin/e-smith/service-status mariadb
ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql/set.password
ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql.private/set.password
ExecStartPre=-/sbin/e-smith/expand-template /root/.my.cnf
ExecStartPre=-/sbin/e-smith/expand-template /etc/my.cnf
# create db here if needed
ExecStartPre=/sbin/e-smith/systemd/mariadb-initialize
#reset
ExecStart=
#ours
ExecStart=/usr/libexec/mysqld \
ExecStart=/usr/sbin/mariadbd \
--defaults-file=/etc/my.cnf \
--basedir=/usr \
--datadir=/var/lib/mysql \
--user=mysql \
--pid-file=/var/run/mariadb/mariadb.pid
--pid-file=/run/mariadb/mariadb.pid
#reset
ExecStartPost=
#ours
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
ExecStartPost=-/sbin/e-smith/systemd/mariadb-post
[Install]
WantedBy=sme-server.target

View File

@ -11,8 +11,10 @@ IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=-/usr/bin/mariadb-upgrade
ExecStart=/sbin/e-smith/systemd/mysql.init start
ExecStop=/sbin/e-smith/systemd/mysql.init stop
SyslogIdentifier=mysql.init
[Install]
WantedBy=sme-server.target

View File

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

0
root/var/lib/mysql.private/.gitignore vendored Normal file
View File

View File

@ -1,8 +1,8 @@
Summary: Koozali SME Server specific mysql configuration and templates.
%define name smeserver-mysql
Name: %{name}
%define version 2.7.0
%define release 19
%define version 11.0.0
%define release 11
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@ -13,13 +13,30 @@ 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
Requires: /usr/bin/mariadb-upgrade
Requires: smeserver-base
Requires: smeserver-lib >= 1.15.1-19
# daemontools bins in use
Requires: /usr/bin/setuidgid
Provides: e-smith-mysql = 2.7.0
Obsoletes: e-smith-mysql < 2.7.0
BuildRequires: e-smith-devtools >= 1.13.1-03
BuildRequires: smeserver-devtools >= 1.13.1-03
# MariaDB from MariaDB repo
Requires: mariadb-server >= 11.4.0
Requires: mariadb >= 11.4.0
Requires: mariadb-backup
Requires: mariadb-connector-c >= 3.4.4
Requires: mariadb-connector-c-config
Requires: MariaDB-connect-engine
# provides some plugins we used to have
Requires: MariaDB-test
# el8 provides /usr/lib64/mariadb/plugin/auth_gssapi.so in mariadb-gssapi-server
# Mariadb provides /usr/lib64/mysql/plugin/auth_gssapi.so in MariaDB-gssapi-server
Requires: MariaDB-gssapi-server
# not available after 10.x
#Requires: MariaDB-compat
Requires: mariadb-common ,mariadb-errmsg,mariadb-server-utils
AutoReqProv: no
%description
@ -31,243 +48,28 @@ mysql.
%setup
%build
for ver in 101 102 103 105
do
mkdir root$ver
done
perl createlinks
#########################################
# full job to create all needed version
#########################################
declare -A versions=([101]="10.1" [102]="10.2" [103]="10.3" [105]="10.5")
declare -A ports=([101]="3310" [102]="3311" [103]="3312" [105]="3313")
for ver in 101 102 103 105
do
##TODO seen those
# 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/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"
vers="${versions[$ver]}"
port="${ports[$ver]}"
# we could choose to override /etc/opt/rh/rh-mariadb101/my.cnf or to force to share /etc/mariadb.log
##Folders
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/etc/e-smith/events/actions
# create configuration db default
#rm -rf etc/e-smith/db/configuration
mkdir -p root$ver/etc/e-smith/db/configuration/{defaults/mariadb$ver-mariadb,defaults/mariadb$ver-mysql.init,migrate}
echo "yes" > root$ver/etc/e-smith/db/configuration/defaults/mariadb$ver-mariadb/LocalNetworkingOnly
echo "enabled" > root$ver/etc/e-smith/db/configuration/defaults/mariadb$ver-mariadb/status
echo "service" > root$ver/etc/e-smith/db/configuration/defaults/mariadb$ver-mariadb/type
echo "enabled" > root$ver/etc/e-smith/db/configuration/defaults/mariadb$ver-mysql.init/status
echo "service" > root$ver/etc/e-smith/db/configuration/defaults/mariadb$ver-mysql.init/type
# create templates.metadata
## for /etc/e-smith/templates/etc/my.cnf/ => /etc/opt/rh/rh-mariadb$ver/my.cnf
mkdir -p root$ver/etc/e-smith/templates.metadata/etc/opt/rh/rh-mariadb$ver
echo 'TEMPLATE_PATH="/etc/my.cnf"' > root$ver/etc/e-smith/templates.metadata/etc/opt/rh/rh-mariadb$ver/my.cnf
# rename/move files
#TODO /etc/e-smith/events
mv root/etc/e-smith/events/smeserver-mariadb$ver-update root$ver/etc/e-smith/events/
#bootstrap-console-save templates + actions
mkdir -p root$ver/etc/e-smith/events/bootstrap-console-save/templates2expand/etc/e-smith/sql/
mkdir -p root$ver/etc/e-smith/events/bootstrap-console-save/templates2expand/etc/opt/rh
mv root/etc/e-smith/events/bootstrap-console-save/S40mariadb$ver-load-tables root$ver/etc/e-smith/events/bootstrap-console-save/
mv root/etc/e-smith/events/bootstrap-console-save/templates2expand/etc/e-smith/sql/init$ver root$ver/etc/e-smith/events/bootstrap-console-save//templates2expand/etc/e-smith/sql/
mv root/etc/e-smith/events/bootstrap-console-save/templates2expand/etc/opt/rh/rh-mariadb$ver root$ver/etc/e-smith/events/bootstrap-console-save//templates2expand/etc/opt/rh/
#pre-backup actions
mkdir -p root$ver/etc/e-smith/events/pre-backup
mv root/etc/e-smith/events/pre-backup/S*mariadb$ver-* root$ver/etc/e-smith/events/pre-backup/
#post-backup actions
mkdir -p root$ver/etc/e-smith/events/post-backup
mv root/etc/e-smith/events/post-backup/S*mariadb$ver-* root$ver/etc/e-smith/events/post-backup/
#pre-restore actions + service
mkdir -p root$ver/etc/e-smith/events/pre-restore
mv root/etc/e-smith/events/pre-restore/S*mariadb$ver-* root$ver/etc/e-smith/events/pre-restore/
#timezone-update service
#/etc/e-smith/events/actions
#TODO
cp rootscl/etc/e-smith/events/actions/mariadb_VER_-delete-db-files root$ver/etc/e-smith/events/actions/mariadb${ver}-delete-db-files
cp rootscl/etc/e-smith/events/actions/mariadb_VER_-delete-dumped-tables root$ver/etc/e-smith/events/actions/mariadb${ver}-delete-dumped-tables
cp rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables root$ver/etc/e-smith/events/actions/mariadb${ver}-dump-tables
cp rootscl/etc/e-smith/events/actions/mariadb_VER_-load-tables root$ver/etc/e-smith/events/actions/mariadb${ver}-load-tables
sed -i root$ver/etc/e-smith/events/actions/mariadb${ver}-delete-db-files \
-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_!!!SOCKET!!!_${socket}_g"
##metadata
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
mkdir -p root$ver/etc/e-smith/templates/etc/e-smith/sql/init$ver
cp root/etc/e-smith/templates/etc/e-smith/sql/init/* root$ver/etc/e-smith/templates/etc/e-smith/sql/init$ver
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_mariadb$ver-mariadb.service_" \
-e "s_/var/run/mariadb/mariadb.pid_${pidfile}_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
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 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" \
-e "s_!!!PORT!!!_${port}_g"
cp -a root/etc/e-smith/templates/etc/my.cnf/014server_system_variables root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-14server_system_variables
sed -i root$ver/etc/e-smith/templates/etc/my.cnf/$ver-14server_system_variables \
-e "s_mariadb_mariadb${ver}\-mariadb_"
cp -a root/etc/e-smith/templates/etc/my.cnf/015logerror root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-15logerror
sed -i root$ver/etc/e-smith/templates/etc/my.cnf/${ver}-15logerror \
-e "s_^log\_error.*_log\_error=${logerror}_"
## /sbin/e-smith
mkdir -p root$ver/sbin/e-smith/systemd
#!!!VER!!!
cp rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize root$ver/sbin/e-smith/systemd/mariadb${ver}-initialize
cp rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init root$ver/sbin/e-smith/systemd/mariadb${ver}-mysql.init
cp rootscl/sbin/e-smith/mariadb_VER_-preload root$ver/sbin/e-smith/mariadb${ver}-preload
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"
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" \
-e "s_!!!SOCKET!!!_${socket}_g" > root$ver/etc/logrotate.d/mariadb${ver}
#systemd service
mkdir -p root$ver/usr/lib/systemd/system/
### the upstream service is called rh-mariadb$ver-mariadb.service
# we use our own /usr/lib/systemd/system/mariadb$ver-mariadb
cp rootscl/usr/lib/systemd/system/mariadb_VER_-mariadb.service root$ver/usr/lib/systemd/system/mariadb${ver}-mariadb.service
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 !
#/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/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
###################################################
# end of per version generation
##################################################
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--file "/sbin/e-smith/systemd/mariadb-initialize" 'attr(0554,root,root)' \
--file "/sbin/e-smith/systemd/mariadb-post" 'attr(0554,root,root)' \
--file "/sbin/e-smith/systemd/mysql.init" 'attr(0554,root,root)' \
--file "/usr/bin/mysql_filter_tables" 'attr(0554,root,root)' \
--file "/usr/bin/mysql_filter_user_table" '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)' \
--dir "/var/lib/mysql.private" 'attr(0751,mysql,mysql)' \
> %{name}-%{version}-filelist
echo "%doc COPYING" >> %{name}-%{version}-filelist
for ver in 101 102 103 105
do
#rm -rf $RPM_BUILD_ROOT
(cd root$ver ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
/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
done
%clean
rm -rf $RPM_BUILD_ROOT
%pre
if [ $1 -gt 1 ] ; then
if [ -e /var/service/mariadb/run ] ; then
/usr/bin/sv d mariadb
/usr/bin/sv d mariadb/log
fi
fi
%post
@ -276,73 +78,38 @@ fi
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
#----------------------------------------------------
%package -n smeserver-mariadb101
Summary: Koozali SME Server mariadb 10.1
Group: Database
Requires: rh-mariadb101
Requires: rh-mariadb101-mariadb
Requires: rh-mariadb101-mariadb-server
BuildRequires: e-smith-devtools >= 1.13.1-03
%description -n smeserver-mariadb101
Koozali SME Server configuration package for mariadb101 RH SCLo
%files -n smeserver-mariadb101 -f %{name}-%{version}-filelist-mariadb101
%defattr(-,root,root)
#----------------------------------------------------
%package -n smeserver-mariadb102
Summary: Koozali SME Server mariadb 10.2
Group: Database
Requires: rh-mariadb102
Requires: rh-mariadb102-mariadb
Requires: rh-mariadb102-mariadb-server
BuildRequires: e-smith-devtools >= 1.13.1-03
%description -n smeserver-mariadb102
Koozali SME Server configuration package for mariadb102 RH SCLo
%files -n smeserver-mariadb102 -f %{name}-%{version}-filelist-mariadb102
%defattr(-,root,root)
#----------------------------------------------------
%package -n smeserver-mariadb103
Summary: Koozali SME Server mariadb 10.3
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
Koozali SME Server configuration package for mariadb103 RH SCLo
%files -n smeserver-mariadb103 -f %{name}-%{version}-filelist-mariadb103
%defattr(-,root,root)
#----------------------------------------------------
%package -n smeserver-mariadb105
Summary: Koozali SME Server mariadb 10.5
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
%files -n smeserver-mariadb105 -f %{name}-%{version}-filelist-mariadb105
%defattr(-,root,root)
#----------------------------------------------------
%changelog
* Fri Mar 07 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- upgrade to support mariadb 11.4 [SME: 12930]
move mariadb-upgrade to mysql.init unit
remove duplicate in 00_restore_dumped_dbs and 10mysql_upgrade,
add a tmp.d for pid file, add post action dnf script
update mariadb.service.d/ content, set default to utfmb4
- mysql.user table filtering [SME: 12592]
* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- prestart script requires daemontools bins [SME: 12566]
* Mon Apr 08 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- add missing mysql.private folder [SME: 11856]
* Sat Apr 06 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- backup users priv, plugins, udfs, servers, stats, timezones [SME: 12591]
* Fri Apr 05 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.sme
- tidy spec and sources for mariadb10.5 support [SME: 12524]
- try to make compatible with higher version from mariadb repo [SME: 11856]
- fix logrotate duplicate entry [SME: 12554]
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-3.sme
- Set license file to GPL2.0 [SME: 12577]
* Sat Mar 23 2024 Brian Read <brianr@koozali.org>11.0.0-2.sme
- Change Requires: e-smith- to Requires:smeserver-
* Sat Mar 23 2024 Brian Read <brianr@koozali.org>11.0.0-1.sme
- Update Release and Version to base version and 1st release for SME11 [SME: 12518]
* Sat Mar 23 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.7.0-19.sme
- Roll up patches and move to git repo [SME: 12338]