File step-cli.spec of Package step-cli
#
# spec file for package step-cli
#
# Copyright (c) 2019 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 http://bugs.opensuse.org/
#
%define configdir /etc/step
%define certsdir /etc/step/certs
%define services cert-renewer.target ssh-cert-renewer.timer ssh-cert-renewer@.timer cert-renewer@.timer ssh-cert-renewer.service ssh-cert-renewer@.service cert-renewer@.service
Name: step-cli
Version: 0.22.0
Release: 0
%define pkg_name cli
%define pkg_version %{version}
Summary: Smallstep CA - CLI
License: Apache-2.0
Group: Productivity/Networking/Security
Url: https://smallstep.com/cli
# https://github.com/smallstep/cli/releases
Source: %{pkg_name}-%{pkg_version}.tar.gz
Source1: vendor.tar.xz
Source2: series
Patch: more-units.patch
Patch1: add-missing-targets.patch
BuildRequires: golang-packaging
BuildRequires: golang(API) >= 1.17
BuildRequires: pkgconfig(systemd)
Conflicts: step
%go_nostrip
%description
A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
%package bash-completion
Summary: Bash Completion for %{name}
Group: Productivity/Networking/Security
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description bash-completion
Bash completion script for %{name}.
%package zsh-completion
Summary: ZSH completion for %{name}
Group: Productivity/Networking/Security
Requires: %{name} = %{version}
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
zsh shell completions for %{name}.
%prep
%autosetup -p1 -n %{pkg_name}-%{pkg_version} -a 1
%build
%goprep github.com/smallstep/cli/
source_date=$(date -u '+%Y-%m-%d %H:%M UTC' -d "@${SOURCE_DATE_EPOCH}")
%gobuild -mod=vendor -ldflags="-w -X 'main.Version=%{version}' -X 'main.BuildTime=${source_date}'" cmd/...
%install
%goinstall
# shell completions
sed -i -e '/^#!\ \//, 1d' autocomplete/bash_autocomplete
install -Dm0644 autocomplete/bash_autocomplete %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm0644 autocomplete/zsh_autocomplete %{buildroot}%{_sysconfdir}/zsh_completion.d/%{name}
for unit in %{services} ; do
install -D -m 0644 systemd/${unit} %{buildroot}%{_unitdir}/${unit}
done
install -D -d -m 0711 %{buildroot}%{configdir}/{certs,config}
%pre
%service_add_pre %{services}
%post
%service_add_post %{services}
%preun
%service_del_preun %{services}
%postun
%service_del_postun %{services}
%files
%doc README.md
%license LICENSE
%{_bindir}/step*
%{_unitdir}/ssh-cert-renewer.service
%{_unitdir}/ssh-cert-renewer.timer
%{_unitdir}/ssh-cert-renewer@.service
%{_unitdir}/ssh-cert-renewer@.timer
%{_unitdir}/cert-renewer@.service
%{_unitdir}/cert-renewer@.timer
%{_unitdir}/cert-renewer.target
%config(noreplace) %attr(-,root,root) %{configdir}
%config(noreplace) %attr(640,root,root) %ghost %{configdir}/config/defaults.json
%files bash-completion
%{_datadir}/bash-completion/completions/%{name}
%files zsh-completion
%dir %{_sysconfdir}/zsh_completion.d
%config %{_sysconfdir}/zsh_completion.d/%{name}