File acmetool.spec of Package acmetool-from-source

# spec file for package acmetool
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%global provider        github
%global provider_tld    com
%global project         hlandau
%global repo            acme
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path     %{provider_prefix}

Name:           acmetool
Version:        0.0.63
Release:        0
Summary:        A automatic certificate acquisition tool for ACME (Let's Encrypt) 
License:        MIT
Group:          Productivity/Networking/Security
Source0:        %{repo}-%{version}.tar.xz
Source1:        acmetool.service
Source2:        acmetool.timer
Source3:        acmetool.tmpfile
Recommends:     cron
BuildRequires:  help2man
BuildRequires:  golang-packaging
BuildRequires:  golang-github-hlandau-xlog
BuildRequires:  golang-github-hlandau-goutils
BuildRequires:  golang-gopkgin-hlandau-service.v2
BuildRequires:  golang-github-hlandau-dexlogconfig
BuildRequires:  golang-github-peterhellberg-link
BuildRequires:  golang-gopkgin-tylerb-graceful.v1
BuildRequires:  golang-gopkgin-square-jose.v1
BuildRequires:  golang-gopkgin-yaml-v2
BuildRequires:  golang-gopkgin-hlandau-svcutils.v1
BuildRequires:  golang-gopkgin-hlandau-easyconfig.v1
BuildRequires:  golang-github-mitchellh-wordwrap
BuildRequires:  golang-gopkgin-cheggaaa-pb.v1
BuildRequires:  golang-github-jmhodges-clock
BuildRequires:  golang-github-satori-uuid
BuildRequires:  golang-github-godbus-dbus
BuildRequires:  golang-github-coreos-systemd
BuildRequires:  golang-org-x-crypto
BuildRequires:  golang-org-x-net
BuildRequires:  go-tools
BuildRequires:  xz
BuildRequires:  fdupes

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Acmetool is an easy-to-use command line tool for automatically acquiring
certificates from ACME servers (such as Let's Encrypt).  Designed to
flexibly integrate into your webserver setup to enable automatic
verification.  Unlike the official Let's Encrypt client, this doesn't modify
your web server configuration.

%setup -qn acme-%{version}
sed -i 's@/var/run@%{_rundir}@g' %{S:3}

%goprep %{import_path}
%gobuild cmd/acmetool

install -Dm0644 %{S:1} %{buildroot}%{_unitdir}/acmetool.service
install -Dm0644 %{S:2} %{buildroot}%{_unitdir}/acmetool.timer
install -Dm0644 %{S:3} %{buildroot}%{_tmpfilesdir}/acmetool.conf
install -dm0755 %{buildroot}%{_sbindir}
install -dm0755 %{buildroot}%{_prefix}/%{_lib}/acme/hooks
install -dm0755 %{buildroot}%{_var}/lib/acme/conf
install -dm0755 %{buildroot}%{_mandir}/man8
find %{buildroot}
help2man --no-discard-stderr -N %{buildroot}%{_bindir}/acmetool > %{buildroot}%{_mandir}/man8/acmetool.8

( cd %{buildroot}%{_sbindir} && ln -s service rcacmetool )

%tmpfiles_create %_tmpfilesdir/acmetool.conf
%service_add_post acmetool.service

%service_del_postun acmetool.service

%service_add_pre acmetool.service

%service_del_preun acmetool.service

%files -f file.lst
%ghost %{_rundir}/acme
## This is more for user to know where this package puts its files
%ghost %{_var}/lib/acme/accounts
%ghost %{_var}/lib/acme/certs
%ghost %{_var}/lib/acme/conf/target
%ghost %{_var}/lib/acme/desired
%ghost %{_var}/lib/acme/keys
%ghost %{_var}/lib/acme/live
%ghost %{_var}/lib/acme/tmp
%ghost %{_var}/lib/acme/conf
%ghost %{_sysconfdir}/cron.d/acmetool
%dir %{_prefix}/%{_lib}/acme
#%%dir %%{_var}/lib/acme/conf
%dir %{_prefix}/%{_lib}/acme/hooks
%ghost %config(noreplace) %{_prefix}/%{_lib}/acme/hooks/haproxy
%ghost %config(noreplace) %{_prefix}/%{_lib}/acme/hooks/reload