%global git_rev ad3b888eda18d946c1af0df0cb69d5bdecd8a7be
%if %{?git_rev}
%global rc_tag _git%(echo %{git_rev} | cut -b 1-7)
%endif

Name:    update-ssh-keys
Version: 0.6.0
Release: 1%{dist}
URL:     https://github.com/flatcar/update-ssh-keys
License: Apache 2.0
Summary: A command line tool for managing openssh authorized public keys

%if %{?git_rev}
Source0: https://github.com/flatcar/update-ssh-keys/archive/%{?git_rev}.zip#/%{name}-%{?git_rev}.zip
%else
Source0: https://github.com/flatcar/update-ssh-keys/archive/refs/tags/v%{version}.tar.gz
%endif

BuildRequires: cargo

%description
%{name} is a command line tool and a library for managing openssh
authorized public keys. It keeps track of sets of keys with names, allows 
for adding additional keys, as well as deleting and disabling them

%prep
%if %{?git_rev}
%autosetup -p1 -n %{name}-%{git_rev}
%else
%autosetup -p1
%endif

%build
cargo build --release

%install
cargo install --path . --root %{buildroot}%{_prefix}

rm -f %{buildroot}%{_prefix}/.crates*

%files
%if %{?rhel} >= 8
%license LICENSE
%else
%doc LICENSE
%endif
%doc CONTRIBUTING.md README.md
%{_bindir}/%{name}

