1 |
%define name smeserver-automysqlbackup |
%define name smeserver-automysqlbackup |
2 |
%define version 3.0.RC6 |
%define version 3.0.RC6 |
3 |
%define release 11 |
%define release 15 |
4 |
%define rpmver 3.0.RC6 |
%define rpmver 3.0.RC6 |
5 |
|
|
6 |
epoch: 2 |
epoch: 2 |
22 |
Patch1: smeserver-automysqlbackup-enhanced-templates.patch |
Patch1: smeserver-automysqlbackup-enhanced-templates.patch |
23 |
Patch2: smeserver-automysqlbackup-fix-runmysql.patch |
Patch2: smeserver-automysqlbackup-fix-runmysql.patch |
24 |
Patch3: smeserver-automysqlbackup-update-permission-change.patch |
Patch3: smeserver-automysqlbackup-update-permission-change.patch |
25 |
|
Patch4: smeserver-automysqlbackup-3.0.RC6-bz10806.errorsAndCreateUsers.patch |
26 |
|
|
27 |
%description |
%description |
28 |
This RPM is an unofficial addon for the SME Server 9.x. |
This RPM is an unofficial addon for the SME Server 9.x. |
33 |
|
|
34 |
|
|
35 |
%changelog |
%changelog |
36 |
|
* Sun Sep 22 2019 Jean-Philipe Pialasse <tests@pialasse.com> 3.0.RC6-14.sme |
37 |
|
- fix multiple cause of error noise and performance [SME: 10806] |
38 |
|
* avoid parallel run of all backups, cron template rewritten |
39 |
|
* avoid multiple parallel or repeated chmod and chown |
40 |
|
* protect from undesired chmod or chown |
41 |
|
* consistent use of status for cron and conf templates |
42 |
|
* create backup user for mysql, mysql55 and mysql57 (Maria to do) |
43 |
|
* update mysql53 use to mysql51 as variable |
44 |
|
* migrate fragment to remove Mysql55 Mysql57 Mymaria Mysql53 if Mysql53 exist |
45 |
|
* remove default value in db for Mysql55 Mysql57 Mymaria Mysql53 |
46 |
|
* default as enabled in fragments for all automysql My* properties |
47 |
|
- create default user in dbs [SME: 10808] |
48 |
|
- tidy spec file |
49 |
|
|
50 |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme |
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme |
51 |
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] |
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] |
52 |
|
|
87 |
%patch1 -p1 |
%patch1 -p1 |
88 |
%patch2 -p1 |
%patch2 -p1 |
89 |
%patch3 -p1 |
%patch3 -p1 |
90 |
|
%patch4 -p1 |
91 |
|
|
92 |
%build |
%build |
93 |
perl createlinks |
perl createlinks |
94 |
|
find . \( -name .gitinclude -o -name .gitignore \) -print0 | \ |
95 |
|
xargs -0 rm -f |
96 |
|
|
97 |
%install |
%install |
98 |
/bin/rm -rf $RPM_BUILD_ROOT |
/bin/rm -rf $RPM_BUILD_ROOT |
100 |
/bin/rm -f %{name}-%{version}-filelist |
/bin/rm -f %{name}-%{version}-filelist |
101 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
102 |
--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ |
--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ |
103 |
|
--dir /root/backup 'attr(0700,root,root)' \ |
104 |
|
--dir /root/backup/db 'attr(0700,root,root)' \ |
105 |
|
--dir /root/backup/db/daily 'attr(0700,root,root)' \ |
106 |
|
--dir /root/backup/db/fullschema 'attr(0700,root,root)' \ |
107 |
|
--dir /root/backup/db/latest 'attr(0700,root,root)' \ |
108 |
|
--dir /root/backup/db/monthly 'attr(0700,root,root)' \ |
109 |
|
--dir /root/backup/db/status 'attr(0700,root,root)' \ |
110 |
|
--dir /root/backup/db/tmp 'attr(0700,root,root)' \ |
111 |
|
--dir /root/backup/db/weekly 'attr(0700,root,root)' \ |
112 |
> %{name}-%{version}-filelist |
> %{name}-%{version}-filelist |
113 |
|
|
114 |
|
|
122 |
%pre |
%pre |
123 |
|
|
124 |
%post |
%post |
|
SMEDB=automysqlbackup |
|
|
MYSQLUSER=backupuser |
|
|
# Expland template |
|
|
/etc/e-smith/events/actions/initialize-default-databases |
|
|
/sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup |
|
|
|
|
|
echo "***********************************************************************" |
|
|
echo " " |
|
|
echo "Creating backup user for default mysql53 database" |
|
|
#create backupuser and give rights |
|
|
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) |
|
|
mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' " |
|
|
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
|
|
mysqladmin flush-privileges |
|
|
/etc/rc.d/init.d/mysql.init start |
|
|
echo "done" |
|
|
echo "*** If you add mysql55/mysql57 you must add a backup user ***" |
|
|
echo "You can use the password from config show automysqlbackup" |
|
|
echo "e.g.: " |
|
|
echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" " |
|
|
echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" " |
|
|
echo " " |
|
|
echo "***********************************************************************" |
|
125 |
|
|
126 |
#protect the backup folder |
#protect the backup folder |
127 |
chmod -R 700 /root/backup/db |
chmod -R 700 /root/backup |
128 |
|
|
129 |
%preun |
%preun |
130 |
%postun |
%postun |