Added systemd support for spec file

pull/93/head
deajan 8 years ago
parent bd0450d95e
commit 1d318b2e8c

@ -1,39 +1,66 @@
Name: osync
Version: 1.2
Release: beta.1%{?dist}
%define name osync
%define gitsource https://github.com/deajan/%{name}/archive/stable.zip
%define use_systemd 1
%{?el5:%define use_systemd 0}
%{?el6:%define use_systemd 0}
Name: %{name}
Version: 1.2RC1
Release: 1%{?dist}
Summary: robust file synchronization tool
Group: Applications/File
License: BSD
URL: https://www.netpower.fr/osync
Source0: https://github.com/deajan/osync/archive/master.zip
Source0: %{gitsource}
Requires: rsync openssh-server
BuildRequires: wget
Requires: rsync openssh-server bash wget
BuildArch: noarch
%description
A robust two way (bidirectional) file sync script based on rsync with fault tolerance, time control and ACL synchronization.
%prep
%setup -q
%build
%configure
#%prep
#%setup -q
#%build
#%configure
%install
wget --no-check-certificate --timeout=5 -O %{_sourcedir}/stable.zip %{gitsource}
( cd %{_sourcedir} && unzip %{_sourcedir}/stable.zip )
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
install -m 755 osync.sh ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 osync-batch.sh ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_unitdir}
install -m 755 %{_sourcedir}/osync-stable/osync.sh ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 %{_sourcedir}/osync-stable/osync-batch.sh ${RPM_BUILD_ROOT}%{_bindir}
install -m 0755 -d ${RPM_BUILD_ROOT}/etc/osync
install -m 0644 %{_sourcedir}/osync-stable/sync.conf.example ${RPM_BUILD_ROOT}/etc/osync
%if %use_systemd
install -m 0755 %{_sourcedir}/osync-stable/osync-srv@.service ${RPM_BUILD_ROOT}%{_unitdir}
%else
install -m 0755 %{_sourcedir}/osync-stable/osync-srv ${RPM_BUILD_ROOT}/etc/init.d
%endif
%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/osync.sh
%doc
%attr(755,root,root) %{_bindir}/osync-batch.sh
%attr(644,root,root) /etc/osync/sync.conf.example
%if %use_systemd
%attr(755,root,root) %{_unitdir}/osync-srv@.service
%else
%attr(755,root,root) /etc/init.d/osync-srv
%endif
%doc
%changelog
* 30 Aug 2016 Orsiris de Jong <ozy@netpower.fr>
* Sun Dec 18 2016 Orsiris de Jong <ozy@netpower.fr>
- Add systemd / initV differentiation
- Make source autodownload work
- Disable all macros except install
* Tue Aug 30 2016 Orsiris de Jong <ozy@netpower.fr>
- Initial spec file

Loading…
Cancel
Save