1 |
%define name smeserver-automysqlbackup |
2 |
%define version 3.0.RC6 |
3 |
%define release 31 |
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 >= 10 |
18 |
Requires: pax |
19 |
Requires: automysqlbackup >= 3.0.RC6-8 |
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 |
Patch6: smeserver-automysqlbackup-3.0.RC6-bz11561.patch |
28 |
Patch7: smeserver-automysqlbackup-3.0.RC6-bz11622.patch |
29 |
Patch8: smeserver-automysqlbackup-3.0.RC6-bz11970.Add-Maria-10x-support.patch |
30 |
Patch9: smeserver-automysqlbackup-3.0.RC6-bz11970.Add-Maria-10x-rename-templates.patch |
31 |
Patch10: smeserver-automysqlbackup-3.0.RC6-bz11970.update-cron.patch |
32 |
Patch11: smeserver-automysqlbackup-3.0.RC6-bz11970.Add-Maria-10x-fix-typos.patch |
33 |
Patch12: smeserver-automysqlbackup-3.0.RC6-bz11970.Add-Maria-10x-rename-cron-directories.patch |
34 |
Patch13: smeserver-automysqlbackup-3.0.RC6-bz11970.update-cron.2.patch |
35 |
Patch14: smeserver-automysqlbackup-3.0.RC6-bz11970.Add.Debug.patch |
36 |
Patch15: smeserver-automysqlbackup-3.0.RC6-remove-myserver-conf-template.patch |
37 |
|
38 |
%description |
39 |
This RPM is an unofficial addon for the SME Server 10.x. |
40 |
The target audience is the Linux/E-smith administrator |
41 |
who wants to backup their mysql databases with an automatic way. |
42 |
This script is based on automysqlbackup V3.0 |
43 |
|
44 |
%changelog |
45 |
* Tue Oct 04 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-31.sme |
46 |
- Remove myserver.conf template expansion as template no longer exists |
47 |
|
48 |
* Mon Aug 22 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-30.sme |
49 |
- Forgot to change the version on the Changelog line below |
50 |
|
51 |
* Mon Aug 22 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-29.sme |
52 |
- Bump automysqlbackup requires |
53 |
|
54 |
* Mon Aug 15 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-28.sme |
55 |
- Add debug patch to conf files |
56 |
|
57 |
* Mon Aug 15 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-27.sme |
58 |
- Modify cron line again to add -bc option [SME: 11970] |
59 |
- Modify runmysqlbackup to add option and conf input from cron |
60 |
|
61 |
* Mon Aug 08 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-26.sme |
62 |
- Change cron directories to match templates [SME:11970] |
63 |
|
64 |
* Mon Aug 08 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-25.sme |
65 |
- Change rc2 to RC6 in config templates [SME:11970] |
66 |
- Fix DONT'T typo |
67 |
|
68 |
* Tue Jun 07 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-24.sme |
69 |
- Update cron [SME:11970] |
70 |
- Fix SQL in Maria 105 |
71 |
- Remove automysql event and leave just smeserver-automysqlbackup-update |
72 |
- Fix some createlinks |
73 |
- Modify inits - but still leaves log errors if version not installed |
74 |
|
75 |
* Tue Jun 07 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-23.sme |
76 |
- Modify backup directory names [SME: 11970] |
77 |
|
78 |
* Tue May 31 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-22.sme |
79 |
- Fix more typos in templates [SME: 11970] |
80 |
|
81 |
* Tue May 31 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-21.sme |
82 |
- Fix typos in templates [SME: 11970] |
83 |
|
84 |
* Mon May 30 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-20.sme |
85 |
- Correct template names [SME: 11970] |
86 |
- Add enable instructions |
87 |
|
88 |
* Mon May 09 2022 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-19.sme |
89 |
- Add Maria DB 10.x support [SME: 11970] |
90 |
- Requires Koozali SME Server v10.x |
91 |
|
92 |
* Sat Jun 05 2021 Terry Fage <terryf@ozemail.com.au> 3.0.RC6-18.sme |
93 |
- mariadb should not backup information_schema [SME: 11622] |
94 |
|
95 |
* Fri Apr 16 2021 Jean-Philippe Pialasse <tests@pialasse.com> 3.0.RC6-17.sme |
96 |
- fix automysql freeze server on reboot after post-upgrade event [SME: 11561] |
97 |
|
98 |
* Mon Oct 19 2020 Brian Read <brianr@bjsystems.co.uk> 3.0-RC6-16.sme |
99 |
- Initial Import to SME10 tree [SME: 11042] |
100 |
- Update-MySQL-Init-for-Mariadb |
101 |
|
102 |
* Sun Sep 22 2019 Jean-Philipe Pialasse <tests@pialasse.com> 3.0.RC6-15.sme |
103 |
- fix multiple cause of error noise and performance [SME: 10806] |
104 |
* avoid parallel run of all backups, cron template rewritten |
105 |
* avoid multiple parallel or repeated chmod and chown |
106 |
* protect from undesired chmod or chown |
107 |
* consistent use of status for cron and conf templates |
108 |
* create backup user for mysql, mysql55 and mysql57 (Maria to do) |
109 |
* update mysql53 use to mysql51 as variable |
110 |
* migrate fragment to remove Mysql55 Mysql57 Mymaria Mysql53 if Mysql53 exist |
111 |
* remove default value in db for Mysql55 Mysql57 Mymaria Mysql53 |
112 |
* default as enabled in fragments for all automysql My* properties |
113 |
- create default user in dbs [SME: 10808] |
114 |
- tidy spec file |
115 |
|
116 |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme |
117 |
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] |
118 |
|
119 |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme |
120 |
- fix runmysqlbackup to allow for new databases [SME: 10654] |
121 |
|
122 |
* Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme |
123 |
- Template configuration files |
124 |
- run automysqlbackup per conf directly from cron rather than runmysqlbackup |
125 |
- Add extra DB keys for mysql53, mysql55, mysql57 |
126 |
|
127 |
* Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme |
128 |
- Added smeserver-automysqlbackup-AdjustableCronJob.patch |
129 |
- The time to run the Job is adjustable |
130 |
|
131 |
* Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme |
132 |
- Added 'epoch: 2' |
133 |
|
134 |
* Sat Aug 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-5.sme |
135 |
- Initial release to contribs9 |
136 |
|
137 |
* Sun Aug 17 2014 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-4 |
138 |
- added my own patch against the --events warning |
139 |
--Warning: Skipping the data of table mysql.event. Specify the --events option explicitly. |
140 |
|
141 |
* Sun Oct 27 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6.3 |
142 |
- split the contrib in two versions smeserver-automysqlbackup and automysqlbackup |
143 |
* Mon Apr 22 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> |
144 |
- [3.0.RC6] version Based on automysqlbackup V3.0 RC6 |
145 |
* Mon Apr 08 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> |
146 |
- [0.01] Initial version Based on automysqlbackup V3.0 RC6 |
147 |
|
148 |
%prep |
149 |
rm -rf $RPM_BUILD_ROOT |
150 |
|
151 |
%setup |
152 |
%patch0 -p1 |
153 |
%patch1 -p1 |
154 |
%patch2 -p1 |
155 |
%patch3 -p1 |
156 |
%patch4 -p1 |
157 |
%patch5 -p1 |
158 |
%patch6 -p1 |
159 |
%patch7 -p1 |
160 |
%patch8 -p1 |
161 |
%patch9 -p1 |
162 |
%patch10 -p1 |
163 |
%patch11 -p1 |
164 |
%patch12 -p1 |
165 |
%patch13 -p1 |
166 |
%patch14 -p1 |
167 |
%patch15 -p1 |
168 |
|
169 |
%build |
170 |
perl createlinks |
171 |
find . \( -name .gitinclude -o -name .gitignore \) -print0 | \ |
172 |
xargs -0 rm -f |
173 |
|
174 |
%install |
175 |
/bin/rm -rf $RPM_BUILD_ROOT |
176 |
(cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
177 |
/bin/rm -f %{name}-%{version}-filelist |
178 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
179 |
--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ |
180 |
--dir /root/backup 'attr(0700,root,root)' \ |
181 |
--dir /root/backup/db 'attr(0700,root,root)' \ |
182 |
--dir /root/backup/db/daily 'attr(0700,root,root)' \ |
183 |
--dir /root/backup/db/fullschema 'attr(0700,root,root)' \ |
184 |
--dir /root/backup/db/latest 'attr(0700,root,root)' \ |
185 |
--dir /root/backup/db/monthly 'attr(0700,root,root)' \ |
186 |
--dir /root/backup/db/status 'attr(0700,root,root)' \ |
187 |
--dir /root/backup/db/tmp 'attr(0700,root,root)' \ |
188 |
--dir /root/backup/db/weekly 'attr(0700,root,root)' \ |
189 |
> %{name}-%{version}-filelist |
190 |
|
191 |
|
192 |
%files -f %{name}-%{version}-filelist |
193 |
|
194 |
%defattr(-,root,root) |
195 |
|
196 |
%clean |
197 |
rm -rf $RPM_BUILD_ROOT |
198 |
|
199 |
%pre |
200 |
|
201 |
%post |
202 |
|
203 |
#protect the backup folder |
204 |
chmod -R 700 /root/backup |
205 |
|
206 |
%preun |
207 |
%postun |
208 |
if [ $1 = 0 ] ; then |
209 |
SMEDB=automysqlbackup |
210 |
MYSQLUSER=backupuser |
211 |
echo "=======================================================================" |
212 |
echo " " |
213 |
echo " delete mysql user and revoke all permissions" |
214 |
# This section deletes backupuser for the standard DB |
215 |
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';" |
216 |
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
217 |
echo " " |
218 |
echo "Do that for each DB - e.g mysq55, mysql57, mariadb101, maria105 etc" |
219 |
echo " " |
220 |
# Delete custom template fragment |
221 |
echo " Deleting configuration automysqlbackup" |
222 |
echo " " |
223 |
echo "=======================================================================" |
224 |
|
225 |
/sbin/e-smith/config delete $SMEDB |
226 |
fi |