/[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.5 - (hide annotations) (download)
Wed Jul 11 23:03:52 2018 UTC (5 years, 10 months ago) by jcrisp
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-9_el6_sme
Changes since 1.4: +24 -2 lines
* Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme
- Template configuration files
- run automysqlbackup per conf directly from cron rather than runmysqlbackup
- Add extra DB keys for mysql53, mysql55, mysql57

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

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