%define config_dir %{_sysconfdir}/consul-template %define debug_package %{nil} Name: consul-template Version: 0.20.0 Release: 7%{?dist} Summary: Consul Template provides a convenient way to populate values from Consul into the filesystem. Group: System Environment/Daemons License: Mozilla Public License, version 2.0 URL: https://github.com/hashicorp/consul-template Source0: https://releases.hashicorp.com/%{name}/%{version}/%{name}_%{version}_linux_amd64.tgz Source1: %{name}.service Source2: %{name}.sysconfig Source3: %{name}-base-config.hcl BuildRequires: systemd-units Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description The daemon consul-template queries a Consul instance and updates any number of specified templates on the filesystem. As an added bonus, consul-template can optionally run arbitrary commands when the update process completes. %prep %setup -q -c %install mkdir -p %{buildroot}%{config_dir}/template %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{config_dir}/config.d/%{name}.hcl %{__install} -p -D -m 0755 %{name} %{buildroot}%{_bindir}/%{name} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %defattr(-,root,root,-) %{_unitdir}/%{name}.service %{_bindir}/%{name} %dir %{config_dir}/config.d %dir %{config_dir}/template %config(noreplace) %{config_dir}/* %config(noreplace) %{_sysconfdir}/sysconfig/%{name}