Name:           automysqlbackup
Version:        3.0_rc6
Release:        2%{?dist}
Summary:        Utilities for automatically backing up mysql databases

License:        GNU Version 2
URL:            https://sourceforge.net/projects/automysqlbackup
Source0:        %{name}-v%{version}.tar.gz
Source1:        %{name}-v%{version}.systemd.timer
Source2:        %{name}-v%{version}.systemd.service
BuildArch:      noarch

BuildRequires:  systemd
%if 0%{?fedora}
BuildRequires:	systemd-rpm-macros
%endif
Requires: 	    mariadb
%{?systemd_requires}

%description
AutoMySQLBackup with a basic configuration will create Daily, Weekly and
Monthly backups of one or more of your MySQL databases from one or more of
your MySQL servers.

Other Features include:
- Email notification of backups
- Backup Compression and Encryption
- Configurable backup rotation
- Incremental database backups

%prep
%setup -q -c %{name}-v%{version}

%build

%install
# Systemd
install -D -m755 automysqlbackup      %{buildroot}/%{_bindir}/automysqlbackup
install -D -m640 automysqlbackup.conf %{buildroot}/%{_sysconfdir}/%{name}/automysqlbackup.conf
install -D -m644 %{SOURCE1}           %{buildroot}/%{_unitdir}/%{name}.timer
install -D -m644 %{SOURCE2}           %{buildroot}/%{_unitdir}/%{name}.service

%post
%systemd_post automysqlbackup.timer

%preun
%systemd_preun automysqlbackup.timer

%postun
%systemd_postun_with_restart automysqlbackup.timer

%files
%doc CHANGELOG LICENSE README
%license LICENSE
%dir %attr(0710, -, -) %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/automysqlbackup.conf
%{_bindir}/automysqlbackup
%{_unitdir}/*.timer
%{_unitdir}/*.service

%changelog
* Sat Jun 27 2020 Greg Wildman <greg@techno.co.za> - 3.0_rc6-1
- Initial spec.