/[smecontribs]/rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec
ViewVC logotype

Annotation of /rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (hide annotations) (download)
Mon Nov 26 13:50:22 2018 UTC (5 years, 11 months ago) by jcrisp
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-10_el6_sme
Changes since 1.5: +7 -1 lines
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme
- fix runmysqlbackup to allow for new databases [SME:10654]

1 unnilennium 1.1 %define name smeserver-automysqlbackup
2 stephdl 1.2 %define version 3.0.RC6
3 jcrisp 1.6 %define release 10
4 unnilennium 1.1 %define rpmver 3.0.RC6
5    
6 stephdl 1.3 epoch: 2
7 unnilennium 1.1 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 stephdl 1.4 Requires: e-smith-base, e-smith-release >= 9
18 unnilennium 1.1 Requires: pax
19     Requires: automysqlbackup
20     BuildRequires: e-smith-devtools
21 stephdl 1.4 Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch
22 jcrisp 1.5 Patch1: smeserver-automysqlbackup-enhanced-templates.patch
23 jcrisp 1.6 Patch2: smeserver-automysqlbackup-fix-runmysql.patch
24    
25 unnilennium 1.1 %description
26 stephdl 1.4 This RPM is an unofficial addon for the SME Server 9.x.
27 unnilennium 1.1 The target audience is the Linux/E-smith administrator
28     who wants to backup their mysql databases with an automatic way.
29     This script is based on automysqlbackup V3.0
30    
31    
32    
33     %changelog
34 jcrisp 1.6 * Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme
35     - fix runmysqlbackup to allow for new databases [SME:10654]
36    
37 jcrisp 1.5 * Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme
38     - Template configuration files
39     - run automysqlbackup per conf directly from cron rather than runmysqlbackup
40     - Add extra DB keys for mysql53, mysql55, mysql57
41    
42 stephdl 1.4 * Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme
43     - Added smeserver-automysqlbackup-AdjustableCronJob.patch
44     - The time to run the Job is adjustable
45    
46 stephdl 1.3 * Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme
47     - Added 'epoch: 2'
48    
49 stephdl 1.2 * Sat Aug 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-5.sme
50     - Initial release to contribs9
51    
52     * Sun Aug 17 2014 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-4
53     - added my own patch against the --events warning
54     --Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
55 unnilennium 1.1
56     * Sun Oct 27 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6.3
57     - split the contrib in two versions smeserver-automysqlbackup and automysqlbackup
58     * Mon Apr 22 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
59     - [3.0.RC6] version Based on automysqlbackup V3.0 RC6
60     * Mon Apr 08 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
61     - [0.01] Initial version Based on automysqlbackup V3.0 RC6
62    
63     %prep
64     rm -rf $RPM_BUILD_ROOT
65    
66     %setup
67 stephdl 1.4 %patch0 -p1
68 jcrisp 1.5 %patch1 -p1
69 jcrisp 1.6 %patch2 -p1
70 unnilennium 1.1
71     %build
72 stephdl 1.4 perl createlinks
73 unnilennium 1.1
74     %install
75     /bin/rm -rf $RPM_BUILD_ROOT
76 stephdl 1.2 (cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
77 unnilennium 1.1 /bin/rm -f %{name}-%{version}-filelist
78 stephdl 1.4 /sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
79     --file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \
80     > %{name}-%{version}-filelist
81 unnilennium 1.1
82    
83     %files -f %{name}-%{version}-filelist
84    
85     %defattr(-,root,root)
86    
87     %clean
88     rm -rf $RPM_BUILD_ROOT
89    
90     %pre
91    
92     %post
93     SMEDB=automysqlbackup
94     MYSQLUSER=backupuser
95     # Expland template
96     /etc/e-smith/events/actions/initialize-default-databases
97 stephdl 1.4 /sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup
98 unnilennium 1.1
99 jcrisp 1.5 echo "***********************************************************************"
100     echo " "
101     echo "Creating backup user for default mysql53 database"
102 unnilennium 1.1 #create backupuser and give rights
103     MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
104 stephdl 1.2 mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
105 unnilennium 1.1 mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
106     mysqladmin flush-privileges
107     /etc/rc.d/init.d/mysql.init start
108 jcrisp 1.5 echo "done"
109     echo "*** If you add mysql55/mysql57 you must add a backup user ***"
110     echo "You can use the password from config show automysqlbackup"
111     echo "e.g.: "
112     echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" "
113     echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" "
114     echo " "
115     echo "***********************************************************************"
116 unnilennium 1.1
117     #protect the backup folder
118     chmod -R 700 /root/backup/db
119    
120     %preun
121     %postun
122     if [ $1 = 0 ] ; then
123     SMEDB=automysqlbackup
124     MYSQLUSER=backupuser
125     echo "======================================================================="
126 jcrisp 1.5 echo " "
127     echo " delete mysql user and revoke all permissions"
128 unnilennium 1.1 # This section deletes backupuser
129     mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
130     mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
131     echo " "
132 jcrisp 1.5 echo "Do that for each DB - e.g mysq55, mysql57 etc"
133     echo " "
134 unnilennium 1.1 # Delete custom template fragment
135     echo " delete db configuration automysqlbackup"
136 jcrisp 1.5 echo " "
137 unnilennium 1.1 echo "======================================================================="
138    
139     /sbin/e-smith/config delete $SMEDB
140     fi

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed