2017-07-12 11:05:50 -07:00
Version: @VERSION@
Release: @BUILD_NUMBER@
2017-06-10 21:51:35 -07:00
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
2017-10-03 20:47:59 -07:00
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
2017-06-10 21:51:35 -07:00
License: Apache 2.0
2017-10-03 20:47:59 -07:00
URL: @PACKAGE_URL@
2017-06-10 21:51:35 -07:00
Packager: Greg Szabo
2017-10-03 20:47:59 -07:00
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
2017-06-10 21:51:35 -07:00
%description
2017-10-03 20:47:59 -07:00
@PACKAGE_DESCRIPTION@
2017-06-10 21:51:35 -07:00
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
2017-10-03 20:47:59 -07:00
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
2017-07-26 14:07:27 -07:00
chmod 755 %{_sysconfdir}/%{name}
2017-10-03 20:47:59 -07:00
chown %{name}.%{name} %{_sysconfdir}/%{name}
2017-06-10 21:51:35 -07:00
fi
%prep
2017-07-12 11:05:50 -07:00
# Nothing to do here. - It is done in the Makefile.
2017-06-10 21:51:35 -07:00
%build
# Nothing to do here.
%install
2017-07-12 11:05:50 -07:00
cd %{name}-%{version}-%{release}
2017-06-10 21:51:35 -07:00
%{__cp} -a * %{buildroot}
%post
2017-10-03 20:47:59 -07:00
sudo -Hu %{name} %{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
2017-07-26 14:39:48 -07:00
2017-06-10 21:51:35 -07:00
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload
%files
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/keystore
%attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/keystore/*
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE