1 |
%define name smeserver-automysqlbackup |
%define name smeserver-automysqlbackup |
2 |
%define version 3.0.RC6 |
%define version 3.0.RC6 |
3 |
%define release 8 |
%define release 11 |
4 |
%define rpmver 3.0.RC6 |
%define rpmver 3.0.RC6 |
5 |
|
|
6 |
epoch: 2 |
epoch: 2 |
19 |
Requires: automysqlbackup |
Requires: automysqlbackup |
20 |
BuildRequires: e-smith-devtools |
BuildRequires: e-smith-devtools |
21 |
Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch |
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 |
|
|
26 |
%description |
%description |
27 |
This RPM is an unofficial addon for the SME Server 9.x. |
This RPM is an unofficial addon for the SME Server 9.x. |
28 |
The target audience is the Linux/E-smith administrator |
The target audience is the Linux/E-smith administrator |
32 |
|
|
33 |
|
|
34 |
%changelog |
%changelog |
35 |
|
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme |
36 |
|
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] |
37 |
|
|
38 |
|
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme |
39 |
|
- fix runmysqlbackup to allow for new databases [SME: 10654] |
40 |
|
|
41 |
|
* Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme |
42 |
|
- Template configuration files |
43 |
|
- run automysqlbackup per conf directly from cron rather than runmysqlbackup |
44 |
|
- Add extra DB keys for mysql53, mysql55, mysql57 |
45 |
|
|
46 |
* Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme |
* Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme |
47 |
- Added smeserver-automysqlbackup-AdjustableCronJob.patch |
- Added smeserver-automysqlbackup-AdjustableCronJob.patch |
48 |
- The time to run the Job is adjustable |
- The time to run the Job is adjustable |
69 |
|
|
70 |
%setup |
%setup |
71 |
%patch0 -p1 |
%patch0 -p1 |
72 |
|
%patch1 -p1 |
73 |
|
%patch2 -p1 |
74 |
|
%patch3 -p1 |
75 |
|
|
76 |
%build |
%build |
77 |
perl createlinks |
perl createlinks |
101 |
/etc/e-smith/events/actions/initialize-default-databases |
/etc/e-smith/events/actions/initialize-default-databases |
102 |
/sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup |
/sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup |
103 |
|
|
104 |
|
echo "***********************************************************************" |
105 |
|
echo " " |
106 |
|
echo "Creating backup user for default mysql53 database" |
107 |
#create backupuser and give rights |
#create backupuser and give rights |
108 |
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) |
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) |
109 |
mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' " |
mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' " |
110 |
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
111 |
mysqladmin flush-privileges |
mysqladmin flush-privileges |
112 |
/etc/rc.d/init.d/mysql.init start |
/etc/rc.d/init.d/mysql.init start |
113 |
|
echo "done" |
114 |
|
echo "*** If you add mysql55/mysql57 you must add a backup user ***" |
115 |
|
echo "You can use the password from config show automysqlbackup" |
116 |
|
echo "e.g.: " |
117 |
|
echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" " |
118 |
|
echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" " |
119 |
|
echo " " |
120 |
|
echo "***********************************************************************" |
121 |
|
|
122 |
#protect the backup folder |
#protect the backup folder |
123 |
chmod -R 700 /root/backup/db |
chmod -R 700 /root/backup/db |
128 |
SMEDB=automysqlbackup |
SMEDB=automysqlbackup |
129 |
MYSQLUSER=backupuser |
MYSQLUSER=backupuser |
130 |
echo "=======================================================================" |
echo "=======================================================================" |
131 |
echo " delete mysql user and revoque all permissions" |
echo " " |
132 |
|
echo " delete mysql user and revoke all permissions" |
133 |
# This section deletes backupuser |
# This section deletes backupuser |
134 |
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';" |
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';" |
135 |
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
136 |
echo " " |
echo " " |
137 |
|
echo "Do that for each DB - e.g mysq55, mysql57 etc" |
138 |
|
echo " " |
139 |
# Delete custom template fragment |
# Delete custom template fragment |
140 |
echo " delete db configuration automysqlbackup" |
echo " delete db configuration automysqlbackup" |
141 |
|
echo " " |
142 |
echo "=======================================================================" |
echo "=======================================================================" |
143 |
|
|
144 |
/sbin/e-smith/config delete $SMEDB |
/sbin/e-smith/config delete $SMEDB |