/[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.7 - (hide annotations) (download)
Tue Nov 27 14:00:37 2018 UTC (6 years ago) by jcrisp
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-11_el6_sme
Changes since 1.6: +7 -2 lines
* Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-11.sme
- fix runmysqlscript to allow for change in Backupdir key [SME: 10655]

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

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