initial commit of file from CVS for smeserver-mysql on Sat Mar 23 16:06:28 AEDT 2024
This commit is contained in:
parent
715005ffa3
commit
df83d181c9
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: smeserver-mysql
|
||||
# $Id: Makefile,v 1.1 2022/03/13 01:13:30 jpp Exp $
|
||||
NAME := smeserver-mysql
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
21
README.md
21
README.md
@ -1,3 +1,20 @@
|
||||
# smeserver-mysql
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-mysql
|
||||
|
||||
SMEServer Koozali developed git repo for smeserver-mysql smeserver
|
||||
SMEServer Koozali developed git repo for smeserver-mysql smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/MySQL
|
||||
<br />https://wiki.koozali.org/Upgrade_php/mysql
|
||||
<br />https://wiki.koozali.org/MySQL/fr
|
||||
<br />https://wiki.koozali.org/MySQL/de
|
||||
<br />https://wiki.koozali.org/MariaDB_alongside_MySQL
|
||||
<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)
|
||||
|
||||
## Description
|
||||
|
||||
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
340
additional/COPYING
Normal file
340
additional/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
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 Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
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".
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
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.
|
||||
|
||||
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.)
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
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
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) 19yy 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
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
cd /var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql && find . -type f | xargs rm -f
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/*.dump
|
@ -0,0 +1,58 @@
|
||||
#!/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
|
@ -0,0 +1,17 @@
|
||||
#!/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
|
@ -0,0 +1,5 @@
|
||||
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";
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
$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";
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
/* 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';
|
||||
|
17
additional/rootscl/etc/logrotate.d/mariadb_VER_
Normal file
17
additional/rootscl/etc/logrotate.d/mariadb_VER_
Normal file
@ -0,0 +1,17 @@
|
||||
/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
|
||||
}
|
61
additional/rootscl/sbin/e-smith/mariadb_VER_-preload
Normal file
61
additional/rootscl/sbin/e-smith/mariadb_VER_-preload
Normal file
@ -0,0 +1,61 @@
|
||||
#!/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);
|
58
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize
Executable file
58
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize
Executable file
@ -0,0 +1,58 @@
|
||||
#!/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
|
82
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init
Executable file
82
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init
Executable file
@ -0,0 +1,82 @@
|
||||
#!/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
|
18
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-post
Normal file
18
additional/rootscl/sbin/e-smith/systemd/mariadb_VER_-post
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in $(seq 1 20);
|
||||
do
|
||||
if [ -S !!!SOCKET!!! ]
|
||||
then
|
||||
/usr/bin/mysql!!!VER!!! < /var/lib/mysql/set.password2
|
||||
echo "root password set"
|
||||
exit 0
|
||||
fi
|
||||
echo waiting for rh-mariadb105-mariadb to start to set root password
|
||||
sleep 1
|
||||
done
|
||||
echo failed to set root password
|
||||
# we fail silently, mariadb will still work, only issue is for phpmyadmin
|
||||
# and non socket access
|
||||
exit 0
|
||||
|
@ -0,0 +1,53 @@
|
||||
[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
|
@ -0,0 +1,20 @@
|
||||
[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
|
||||
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
||||
sme10
|
131
createlinks
Executable file
131
createlinks
Executable file
@ -0,0 +1,131 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
my @versions = ( 101, 102, 103, 105);
|
||||
|
||||
#--------------------------------------------------
|
||||
# pre-backup actions
|
||||
#--------------------------------------------------
|
||||
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
|
||||
#--------------------------------------------------
|
||||
$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";
|
||||
|
||||
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
|
||||
#--------------------------------------------------
|
||||
$event = "bootstrap-console-save";
|
||||
|
||||
foreach (qw(
|
||||
/etc/my.cnf
|
||||
/root/.my.cnf
|
||||
/var/lib/mysql/set.password
|
||||
))
|
||||
{
|
||||
templates2events("$_", $event);
|
||||
}
|
||||
|
||||
# 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
|
||||
#--------------------------------------------------
|
||||
$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
|
||||
#--------------------------------------------------
|
||||
$event = "smeserver-mysql-update";
|
||||
|
||||
foreach (qw(
|
||||
/etc/my.cnf
|
||||
/root/.my.cnf
|
||||
/var/lib/mysql/set.password
|
||||
))
|
||||
{
|
||||
templates2events("$_", $event);
|
||||
}
|
||||
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
yes
|
@ -0,0 +1 @@
|
||||
enabled
|
1
root/etc/e-smith/db/configuration/defaults/mariadb/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/mariadb/type
Normal file
@ -0,0 +1 @@
|
||||
service
|
@ -0,0 +1 @@
|
||||
enabled
|
@ -0,0 +1 @@
|
||||
service
|
11
root/etc/e-smith/db/configuration/migrate/00mysqld2mariadb
Normal file
11
root/etc/e-smith/db/configuration/migrate/00mysqld2mariadb
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
# Rename mysqld service entry to mariadb
|
||||
|
||||
my $mysqld = $DB->get('mysqld') or return;
|
||||
my $mariadb = $DB->get('mariadb') ||
|
||||
$DB->new_record('mariadb', { type => 'service' });
|
||||
|
||||
$mariadb->merge_props($mysqld->props);
|
||||
$mysqld->delete;
|
||||
|
||||
}
|
6
root/etc/e-smith/db/configuration/migrate/15innodb
Normal file
6
root/etc/e-smith/db/configuration/migrate/15innodb
Normal file
@ -0,0 +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');
|
||||
}
|
3
root/etc/e-smith/events/actions/mysql-delete-db-files
Normal file
3
root/etc/e-smith/events/actions/mysql-delete-db-files
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
cd /var/lib/mysql && find . -type f | xargs rm -f
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /bin/rm -f /home/e-smith/db/mysql/*.dump
|
41
root/etc/e-smith/events/actions/mysql-dump-tables
Normal file
41
root/etc/e-smith/events/actions/mysql-dump-tables
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
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 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."
|
||||
mysqldump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$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..."
|
||||
mysqlcheck -s --auto-repair -c "$db" && \
|
||||
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$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 $(mysql -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$")
|
||||
do
|
||||
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db".dump || onfailure $db
|
||||
done
|
17
root/etc/e-smith/events/actions/mysql-load-tables
Normal file
17
root/etc/e-smith/events/actions/mysql-load-tables
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
status=$(/sbin/e-smith/config getprop mariadb status)
|
||||
if [ "$status" = "disabled" ]
|
||||
then
|
||||
echo "mysqld is disabled - no tables restored" >&2
|
||||
exit 0
|
||||
fi
|
||||
/bin/rm -f /home/e-smith/db/mysql/information_schema.dump
|
||||
/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')
|
||||
do
|
||||
mv $db /etc/e-smith/sql/init/01_$(basename $db .dump).sql
|
||||
done
|
||||
fi
|
0
root/etc/e-smith/sql/init/.gitignore
vendored
Normal file
0
root/etc/e-smith/sql/init/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
PERMS=0540
|
@ -0,0 +1 @@
|
||||
PERMS=0540
|
@ -0,0 +1,3 @@
|
||||
PERMS=0400
|
||||
UID="root"
|
||||
GID="root"
|
@ -0,0 +1,3 @@
|
||||
PERMS=0400
|
||||
UID="root"
|
||||
GID="root"
|
@ -0,0 +1,19 @@
|
||||
#! /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
|
||||
/usr/bin/systemctl restart mariadb.service
|
||||
for i in $(seq 1 20);
|
||||
do
|
||||
if [ -f /var/run/mariadb/mariadb.pid ]
|
||||
then
|
||||
/bin/rm /home/e-smith/db/mysql/mysql.dump
|
||||
exit 0
|
||||
fi
|
||||
echo waiting for mysqld to restart
|
||||
sleep 1
|
||||
done
|
||||
echo mysqld failed to restart
|
||||
exit 1
|
@ -0,0 +1,16 @@
|
||||
#!/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
|
33
root/etc/e-smith/templates/etc/my.cnf/000readme
Normal file
33
root/etc/e-smith/templates/etc/my.cnf/000readme
Normal file
@ -0,0 +1,33 @@
|
||||
###########################################################
|
||||
# Here is a cheat-sheet for this file as of MySQL 4.0.14
|
||||
# 2003-12-18 - tony_clayton@mitel.com
|
||||
#
|
||||
# 1. The mysqld binary reads options from the [mysqld] section,
|
||||
# and then overrides those values with any passed-in
|
||||
# arguments.
|
||||
#
|
||||
# 2. The mysqld_safe script reads options from the following
|
||||
# sections in order, overriding any previous values with newer
|
||||
# ones:
|
||||
# [mysqld] [server] [mysqld_safe] [safe_mysqld]
|
||||
# It then overrides those values with any passed-in
|
||||
# arguments, and invokes the mysqld binary (see #1 above) with
|
||||
# the resulting argument list.
|
||||
#
|
||||
# * The server and safe_mysqld sections are deprecated in
|
||||
# favour of mysqld and mysqld_safe respectively.
|
||||
#
|
||||
# 3. The mysql or mysqld initscript reads options from the
|
||||
# following sections in order, overriding any previous values
|
||||
# with newer ones:
|
||||
# [mysqld] [mysql_server] [mysql.server]
|
||||
# It then overrides those values with any passed-in arguments,
|
||||
# and invokes the mysqld_safe script (see #2 above) with the
|
||||
# resulting argument list.
|
||||
#
|
||||
# * The SMEServer doesn't have any need for initscript-only
|
||||
# options, so we don't use mysql_server and mysql.server
|
||||
# sections.
|
||||
#
|
||||
###########################################################
|
||||
|
1
root/etc/e-smith/templates/etc/my.cnf/005mysqld
Normal file
1
root/etc/e-smith/templates/etc/my.cnf/005mysqld
Normal file
@ -0,0 +1 @@
|
||||
[mysqld]
|
1
root/etc/e-smith/templates/etc/my.cnf/006pid-file
Normal file
1
root/etc/e-smith/templates/etc/my.cnf/006pid-file
Normal file
@ -0,0 +1 @@
|
||||
pid-file=/var/run/mariadb/mariadb.pid
|
1
root/etc/e-smith/templates/etc/my.cnf/007basedir
Normal file
1
root/etc/e-smith/templates/etc/my.cnf/007basedir
Normal file
@ -0,0 +1 @@
|
||||
basedir=/usr
|
1
root/etc/e-smith/templates/etc/my.cnf/008datadir
Normal file
1
root/etc/e-smith/templates/etc/my.cnf/008datadir
Normal file
@ -0,0 +1 @@
|
||||
datadir=/var/lib/mysql
|
14
root/etc/e-smith/templates/etc/my.cnf/009innodb
Normal file
14
root/etc/e-smith/templates/etc/my.cnf/009innodb
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#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' }
|
||||
|
5
root/etc/e-smith/templates/etc/my.cnf/009socket
Normal file
5
root/etc/e-smith/templates/etc/my.cnf/009socket
Normal file
@ -0,0 +1,5 @@
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
{
|
||||
my $localonly = $mariadb{LocalNetworkingOnly} || "no";
|
||||
$OUT = ($localonly eq 'yes') ? "skip-networking" : "# networking is enabled";
|
||||
}
|
1
root/etc/e-smith/templates/etc/my.cnf/011user
Normal file
1
root/etc/e-smith/templates/etc/my.cnf/011user
Normal file
@ -0,0 +1 @@
|
||||
user=mysql
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
$OUT = '';
|
||||
# changed 0 to 32186 for mariadb 5.5 see BZ 12417
|
||||
my $limit = ${'mariadb'}{OpenFilesLimit} || 32186;
|
||||
return if $limit eq 0;
|
||||
|
||||
$OUT .= "open_files_limit=$limit\n";
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
{
|
||||
$OUT = '';
|
||||
my $var;
|
||||
$var = ${'mariadb'}{'MaxConnections'} || undef;
|
||||
#default 151; range 10 to 100000
|
||||
$OUT .= "max_connections=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'WaitTimeout'} || undef;
|
||||
#default 28800
|
||||
$OUT .= "wait_timeout=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'QueryCacheLimit'} || undef;
|
||||
#default 1048576 (1M)
|
||||
$OUT .= "query_cache_limit=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'QueryCacheSize'} || '1M';
|
||||
#default 1048576 (1M)
|
||||
$OUT .= "query_cache_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'QueryCacheType'} || '1';
|
||||
#default 0 or OFF, 1 or ON, 2 or DEMAND
|
||||
$OUT .= "query_cache_type=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'SortBufferSize'} || undef;
|
||||
#default 2M
|
||||
$OUT .= "sort_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'ReadRndBufferSize'} || undef;
|
||||
#default 262144 from 8200 to 2147483647
|
||||
$OUT .= "read_rnd_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'TableOpenCache'} || undef;
|
||||
#default 400 (2000 sice 10.1.7)
|
||||
$OUT .= "table_open_cache=$var\n" if defined $var;
|
||||
|
||||
#Introduced: MariaDB 10.2.2
|
||||
#$var = ${'mariadb'}{'TableOpenCacheInstances'} || undef;
|
||||
##default 8
|
||||
#$OUT .= "table_open_cache_instances=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'TmpTableSize'} || undef;
|
||||
#default 16M
|
||||
$OUT .= "tmp_table_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'MaxHeapTableSize'} || undef;
|
||||
#default 16M
|
||||
$OUT .= "max_heap_table_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'ThreadCacheSize'} || 256;
|
||||
#default 0 from 0 to 16384
|
||||
$OUT .= "thread_cache_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'KeyBufferSize'} || undef;
|
||||
#default 134217728 - myisam only
|
||||
$OUT .= "key_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'MyisamSortBufferSize'} || undef;
|
||||
#default 128M - before 10.0.3: 8M
|
||||
$OUT .= "myisam_sort_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'JoinBufferSize'} || 262144;
|
||||
#default 262144
|
||||
$OUT .= "join_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'ReadBufferSize'} || undef;
|
||||
#default 131072
|
||||
$OUT .= "read_buffer_size=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'ConnectTimeout'} || undef;
|
||||
#default 10
|
||||
$OUT .= "connect_timeout=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'MaxConnectErrors'} || 100;
|
||||
#default 100
|
||||
$OUT .= "max_connect_errors=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'MaxAllowedPacket'} || '16M';
|
||||
#default 4M
|
||||
$OUT .= "max_allowed_packet=$var\n" if defined $var;
|
||||
|
||||
$var = ${'mariadb'}{'SlowQueries'} ||undef;
|
||||
if (defined $var)
|
||||
{
|
||||
$OUT .= "log_slow_queries=1\n"; # change to slow_query_log in mariadb 10.1
|
||||
$OUT .= "long_query_time=$var\n";
|
||||
$OUT .= "slow_query_log_file=\"/var/log/mariadb/slow_queries.log\"\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
3
root/etc/e-smith/templates/etc/my.cnf/015logerror
Normal file
3
root/etc/e-smith/templates/etc/my.cnf/015logerror
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
log_error=/var/log/mariadb/mariadb.log
|
||||
|
4
root/etc/e-smith/templates/etc/my.cnf/040mysqld_safe
Normal file
4
root/etc/e-smith/templates/etc/my.cnf/040mysqld_safe
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
{ # allow backwards-compatibility with safe_mysqld (mysql < 4.0)
|
||||
-f "/usr/bin/mysqld_safe" ? "[mysqld_safe]" : "[safe_mysqld]";
|
||||
}
|
14
root/etc/e-smith/templates/etc/rsyslog.conf/32mysqlinit
Normal file
14
root/etc/e-smith/templates/etc/rsyslog.conf/32mysqlinit
Normal file
@ -0,0 +1,14 @@
|
||||
# *-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
|
||||
|
1
root/etc/e-smith/templates/root/.my.cnf/50client
Normal file
1
root/etc/e-smith/templates/root/.my.cnf/50client
Normal file
@ -0,0 +1 @@
|
||||
[client]
|
9
root/etc/e-smith/templates/root/.my.cnf/55password
Normal file
9
root/etc/e-smith/templates/root/.my.cnf/55password
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
#----------------------------------------------------------
|
||||
# Read (and possibly create) DAP password
|
||||
#----------------------------------------------------------
|
||||
|
||||
use esmith::util;
|
||||
my $pw = esmith::util::LdapPassword;
|
||||
$OUT .= "password=$pw";
|
||||
}
|
9
root/etc/e-smith/templates/root/.my.cnf/template-begin
Normal file
9
root/etc/e-smith/templates/root/.my.cnf/template-begin
Normal file
@ -0,0 +1,9 @@
|
||||
#------------------------------------------------------------
|
||||
# DO NOT MODIFY THIS FILE! It is updated automatically by the
|
||||
# e-smith server and gateway software. Instead, modify the source
|
||||
# template in the /etc/e-smith/templates directory. For more
|
||||
# information, see http://www.e-smith.org.
|
||||
#
|
||||
# copyright (C) 1999-2001 e-smith, inc.
|
||||
#------------------------------------------------------------
|
||||
|
4
root/etc/e-smith/templates/root/.my.cnf/template-end
Normal file
4
root/etc/e-smith/templates/root/.my.cnf/template-end
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
#------------------------------------------------------------
|
||||
# TEMPLATE END
|
||||
#------------------------------------------------------------
|
12
root/etc/e-smith/templates/var/lib/mysql/set.password
Normal file
12
root/etc/e-smith/templates/var/lib/mysql/set.password
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
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";
|
||||
}
|
9
root/etc/e-smith/templates/var/lib/mysql/set.password2
Normal file
9
root/etc/e-smith/templates/var/lib/mysql/set.password2
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
use esmith::util;
|
||||
|
||||
my $pw = esmith::util::LdapPassword();
|
||||
|
||||
$OUT .= "use mysql;\n";
|
||||
$OUT .= "SET PASSWORD FOR 'root'\@localhost = PASSWORD(\"$pw\"); \n";
|
||||
$OUT .= "FLUSH PRIVILEGES;\n";
|
||||
}
|
17
root/etc/logrotate.d/mariadb-sme
Normal file
17
root/etc/logrotate.d/mariadb-sme
Normal file
@ -0,0 +1,17 @@
|
||||
/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
|
||||
}
|
||||
|
9
root/etc/logrotate.d/mysqlinit
Normal file
9
root/etc/logrotate.d/mysqlinit
Normal file
@ -0,0 +1,9 @@
|
||||
/var/log/mysql.init/*.log {
|
||||
create 640 root root
|
||||
notifempty
|
||||
daily
|
||||
rotate 3
|
||||
missingok
|
||||
compress
|
||||
}
|
||||
|
0
root/home/e-smith/db/mysql/.gitignore
vendored
Normal file
0
root/home/e-smith/db/mysql/.gitignore
vendored
Normal file
61
root/sbin/e-smith/mysql-preload
Normal file
61
root/sbin/e-smith/mysql-preload
Normal file
@ -0,0 +1,61 @@
|
||||
#!/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 = "/usr/libexec/mysqld";
|
||||
if (-f "/usr/sbin/mysqld") {
|
||||
$mysqld = "/usr/sbin/mysqld";
|
||||
}
|
||||
# Hard-code user, since it is set in mysqld_safe currently.
|
||||
# See http://bugs.mysql.com/2163
|
||||
exec($mysqld, qw(--bootstrap --user=mysql --skip-grant-tables));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
warn "Couldn't fork: $!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
system("/usr/bin/mysql < $file");
|
||||
}
|
||||
exit(0);
|
14
root/sbin/e-smith/systemd/mariadb-initialize
Normal file
14
root/sbin/e-smith/systemd/mariadb-initialize
Normal file
@ -0,0 +1,14 @@
|
||||
#! /bin/sh
|
||||
|
||||
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
|
||||
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
|
72
root/sbin/e-smith/systemd/mysql.init
Normal file
72
root/sbin/e-smith/systemd/mysql.init
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2002 Mitel Networks Corporation
|
||||
#
|
||||
# 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.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Source function library.
|
||||
SYSTEMCTL_SKIP_REDIRECT=1
|
||||
. /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 /var/lib/mysql/mysql.sock
|
||||
then
|
||||
exit_value=0
|
||||
HOME=/root
|
||||
export HOME
|
||||
for link in $(find /etc/e-smith/sql/init -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 mysql" perl -e '
|
||||
open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
|
||||
open (STDOUT, ">&STDERR");
|
||||
exec "/usr/bin/mysql";' < $link && /bin/rm $link
|
||||
;;
|
||||
*)
|
||||
action "Loading $F into mysql" perl -e '
|
||||
open (STDERR, "|/usr/bin/logger -p local1.info -t mysql.init");
|
||||
open (STDOUT, ">&STDERR");
|
||||
exec shift; ' $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
|
43
root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf
Normal file
43
root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf
Normal file
@ -0,0 +1,43 @@
|
||||
[Unit]
|
||||
Description=MariaDB database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
#reset
|
||||
ExecStartPre=
|
||||
#ours : we need root user as + and ! are not yet supported
|
||||
ExecStartPre=-/sbin/e-smith/service-status 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/systemd/mariadb-initialize
|
||||
|
||||
#reset
|
||||
ExecStart=
|
||||
#ours
|
||||
ExecStart=/usr/libexec/mysqld \
|
||||
--defaults-file=/etc/my.cnf \
|
||||
--basedir=/usr \
|
||||
--datadir=/var/lib/mysql \
|
||||
--user=mysql \
|
||||
--pid-file=/var/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
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
18
root/usr/lib/systemd/system/mysql.init.service
Normal file
18
root/usr/lib/systemd/system/mysql.init.service
Normal file
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Koozali SME Server mysql DB injector for mariadb
|
||||
After=mariadb.service
|
||||
Requires=mariadb.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Restart=no
|
||||
TimeoutSec=10min
|
||||
IgnoreSIGPIPE=no
|
||||
KillMode=process
|
||||
GuessMainPID=no
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/sbin/e-smith/systemd/mysql.init start
|
||||
ExecStop=/sbin/e-smith/systemd/mysql.init stop
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
0
root/var/log/mariadb/.gitignore
vendored
Normal file
0
root/var/log/mariadb/.gitignore
vendored
Normal file
1176
smeserver-mysql.spec
Normal file
1176
smeserver-mysql.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user