1 |
%define name smeserver-automysqlbackup |
2 |
%define version 3.0.RC6 |
3 |
%define release 16 |
4 |
%define rpmver 3.0.RC6 |
5 |
|
6 |
epoch: 2 |
7 |
Summary: automysqlbackup is a script to backup your msql database on sme8 |
8 |
Name: %{name} |
9 |
Version: %{version} |
10 |
Release: %{release}%{?dist} |
11 |
License: GPL |
12 |
Group: /Web/Application |
13 |
Source: %{name}-%{version}.tar.gz |
14 |
URL: http://sourceforge.net/projects/automysqlbackup/ |
15 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
16 |
BuildArchitectures: noarch |
17 |
Requires: e-smith-base, e-smith-release >= 9 |
18 |
Requires: pax |
19 |
Requires: automysqlbackup |
20 |
BuildRequires: e-smith-devtools |
21 |
Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch |
22 |
Patch1: smeserver-automysqlbackup-enhanced-templates.patch |
23 |
Patch2: smeserver-automysqlbackup-fix-runmysql.patch |
24 |
Patch3: smeserver-automysqlbackup-update-permission-change.patch |
25 |
Patch4: smeserver-automysqlbackup-3.0.RC6-bz10806.errorsAndCreateUsers.patch |
26 |
Patch5: smeserver-automysqlbackup-3.0.RC6-Update-MySQL-Init-for-Mariadb.patch |
27 |
|
28 |
%description |
29 |
This RPM is an unofficial addon for the SME Server 9.x. |
30 |
The target audience is the Linux/E-smith administrator |
31 |
who wants to backup their mysql databases with an automatic way. |
32 |
This script is based on automysqlbackup V3.0 |
33 |
|
34 |
|
35 |
|
36 |
%changelog |
37 |
* Mon Oct 19 2020 Brian Read <brianr@bjsystems.co.uk> 3.0-RC6-16.sme |
38 |
- Initial Import to SME10 tree [SME: 11042] |
39 |
- Update-MySQL-Init-for-Mariadb |
40 |
|
41 |
* Sun Sep 22 2019 Jean-Philipe Pialasse <tests@pialasse.com> 3.0.RC6-15.sme |
42 |
- fix multiple cause of error noise and performance [SME: 10806] |
43 |
* avoid parallel run of all backups, cron template rewritten |
44 |
* avoid multiple parallel or repeated chmod and chown |
45 |
* protect from undesired chmod or chown |
46 |
* consistent use of status for cron and conf templates |
47 |
* create backup user for mysql, mysql55 and mysql57 (Maria to do) |
48 |
* update mysql53 use to mysql51 as variable |
49 |
* migrate fragment to remove Mysql55 Mysql57 Mymaria Mysql53 if Mysql53 exist |
50 |
* remove default value in db for Mysql55 Mysql57 Mymaria Mysql53 |
51 |
* default as enabled in fragments for all automysql My* properties |
52 |
- create default user in dbs [SME: 10808] |
53 |
- tidy spec file |
54 |
|
55 |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme |
56 |
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] |
57 |
|
58 |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme |
59 |
- fix runmysqlbackup to allow for new databases [SME: 10654] |
60 |
|
61 |
* Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme |
62 |
- Template configuration files |
63 |
- run automysqlbackup per conf directly from cron rather than runmysqlbackup |
64 |
- Add extra DB keys for mysql53, mysql55, mysql57 |
65 |
|
66 |
* Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme |
67 |
- Added smeserver-automysqlbackup-AdjustableCronJob.patch |
68 |
- The time to run the Job is adjustable |
69 |
|
70 |
* Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme |
71 |
- Added 'epoch: 2' |
72 |
|
73 |
* Sat Aug 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-5.sme |
74 |
- Initial release to contribs9 |
75 |
|
76 |
* Sun Aug 17 2014 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-4 |
77 |
- added my own patch against the --events warning |
78 |
--Warning: Skipping the data of table mysql.event. Specify the --events option explicitly. |
79 |
|
80 |
* Sun Oct 27 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6.3 |
81 |
- split the contrib in two versions smeserver-automysqlbackup and automysqlbackup |
82 |
* Mon Apr 22 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> |
83 |
- [3.0.RC6] version Based on automysqlbackup V3.0 RC6 |
84 |
* Mon Apr 08 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> |
85 |
- [0.01] Initial version Based on automysqlbackup V3.0 RC6 |
86 |
|
87 |
%prep |
88 |
rm -rf $RPM_BUILD_ROOT |
89 |
|
90 |
%setup |
91 |
%patch0 -p1 |
92 |
%patch1 -p1 |
93 |
%patch2 -p1 |
94 |
%patch3 -p1 |
95 |
%patch4 -p1 |
96 |
%patch5 -p1 |
97 |
|
98 |
%build |
99 |
perl createlinks |
100 |
find . \( -name .gitinclude -o -name .gitignore \) -print0 | \ |
101 |
xargs -0 rm -f |
102 |
|
103 |
%install |
104 |
/bin/rm -rf $RPM_BUILD_ROOT |
105 |
(cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
106 |
/bin/rm -f %{name}-%{version}-filelist |
107 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
108 |
--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ |
109 |
--dir /root/backup 'attr(0700,root,root)' \ |
110 |
--dir /root/backup/db 'attr(0700,root,root)' \ |
111 |
--dir /root/backup/db/daily 'attr(0700,root,root)' \ |
112 |
--dir /root/backup/db/fullschema 'attr(0700,root,root)' \ |
113 |
--dir /root/backup/db/latest 'attr(0700,root,root)' \ |
114 |
--dir /root/backup/db/monthly 'attr(0700,root,root)' \ |
115 |
--dir /root/backup/db/status 'attr(0700,root,root)' \ |
116 |
--dir /root/backup/db/tmp 'attr(0700,root,root)' \ |
117 |
--dir /root/backup/db/weekly 'attr(0700,root,root)' \ |
118 |
> %{name}-%{version}-filelist |
119 |
|
120 |
|
121 |
%files -f %{name}-%{version}-filelist |
122 |
|
123 |
%defattr(-,root,root) |
124 |
|
125 |
%clean |
126 |
rm -rf $RPM_BUILD_ROOT |
127 |
|
128 |
%pre |
129 |
|
130 |
%post |
131 |
|
132 |
#protect the backup folder |
133 |
chmod -R 700 /root/backup |
134 |
|
135 |
%preun |
136 |
%postun |
137 |
if [ $1 = 0 ] ; then |
138 |
SMEDB=automysqlbackup |
139 |
MYSQLUSER=backupuser |
140 |
echo "=======================================================================" |
141 |
echo " " |
142 |
echo " delete mysql user and revoke all permissions" |
143 |
# This section deletes backupuser |
144 |
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';" |
145 |
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
146 |
echo " " |
147 |
echo "Do that for each DB - e.g mysq55, mysql57 etc" |
148 |
echo " " |
149 |
# Delete custom template fragment |
150 |
echo " delete db configuration automysqlbackup" |
151 |
echo " " |
152 |
echo "=======================================================================" |
153 |
|
154 |
/sbin/e-smith/config delete $SMEDB |
155 |
fi |