File step-kms-plugin.spec of Package step-kms-plugin
#
# spec file for package step-kms-plugin
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define configdir %{_sysconfdir}/step
%define certsdir %{_sysconfdir}/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
%define pkg_name %{name}
%define pkg_version %{version}
Name: step-kms-plugin
Version: 0.15.1
Release: 0
Summary: Smallstep CA - KMS plugin
License: Apache-2.0
URL: https://github.com/smallstep/step-kms-plugin
# https://github.com/smallstep/step-kms-plugin/releases
Source: %{pkg_name}-%{pkg_version}.tar.gz
Source1: vendor.tar.xz
BuildRequires: fish
BuildRequires: golang(API) >= 1.21
BuildRequires: golang-packaging
BuildRequires: pkgconfig
BuildRequires: zsh
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(libpcsclite)
BuildRequires: pkgconfig(systemd)
Requires: step-ca
%description
A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
KMS plugin.
%package bash-completion
Summary: Bash Completion for %{name}
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}
Requires: %{name} = %{version}
Requires: zsh
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
zsh shell completions for %{name}.
%package fish-completion
Summary: Fish completion for %{name}
Requires: %{name} = %{version}
Requires: fish
Supplements: (%{name} and zsh)
BuildArch: noarch
%description fish-completion
fish shell completions for %{name}.
%prep
%autosetup -p1 -n %{pkg_name}-%{pkg_version} -a 1
%build
PKG=github.com/smallstep/step-kms-plugin
DATE_FMT="+%%Y-%%m-%%dT%%H:%%M:%%SZ"
BUILD_DATE=$(date -u -d "@${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u "${DATE_FMT}")
go build -mod=vendor -buildmode=pie -o bin/step-kms-plugin -ldflags="-w -X '${PKG}/cmd.Version=%{version}' -X '${PKG}/cmd.ReleaseDate=${BUILD_DATE}'"
go generate ./...
mkdir -p completions
bin/step-kms-plugin completion bash > completions/bash_completion
bin/step-kms-plugin completion fish > completions/fish_completion
bin/step-kms-plugin completion powershell > completions/powershell_completion
bin/step-kms-plugin completion zsh > completions/zsh_completion
%install
install -D -m 0755 bin/step-kms-plugin %{buildroot}/%{_bindir}/step-kms-plugin
# shell completions
install -D -m 0644 completions/bash_completion %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -D -m 0644 completions/zsh_completion %{buildroot}%{_sysconfdir}/zsh_completion.d/%{name}
install -D -m 0644 completions/fish_completion %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
%check
bin/step-kms-plugin version | grep '%{version}'
%files
%doc README.md
%license LICENSE
%{_bindir}/step*
%files bash-completion
%license LICENSE
%{_datadir}/bash-completion/completions/%{name}
%files zsh-completion
%license LICENSE
%config %{_sysconfdir}/zsh_completion.d/%{name}
%files fish-completion
%license LICENSE
%{_datadir}/fish/vendor_completions.d/%{name}.fish
%changelog