diff --git a/rust-ssh-key-dir.spec b/rust-ssh-key-dir.spec new file mode 100644 index 0000000000000000000000000000000000000000..a1cc009d7984fc2402b3bd23c98743bbb6ca06de --- /dev/null +++ b/rust-ssh-key-dir.spec @@ -0,0 +1,81 @@ +%define debug_package %{nil} +%bcond_without check +%global __cargo_skip_build 0 + +%global crate ssh-key-dir + +Name: rust-%{crate} +Version: 0.1.2 +Release: 1 +Summary: sshd AuthorizedKeysCommand to read ~/.ssh/authorized_keys.d + +License: ASL 2.0 +URL: https://crates.io/crates/ssh-key-dir +Source: %{crate}-%{version}.crate +Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz + + +BuildRequires: rust-packaging + +%global _description %{expand: +sshd AuthorizedKeysCommand to read key files from ~/.ssh/authorized_keys.d.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +License: ASL 2.0 and MIT +Requires: openssh-server +Requires(post): openssh-server +Requires(post): systemd +Requires(postun): openssh-server +Requires(postun): systemd + +%description -n %{crate} %{_description} + +%files -n %{crate} +%{_libexecdir}/ssh-key-dir +%config(noreplace) %{_sysconfdir}/ssh/sshd_config.d/40-ssh-key-dir.conf +%doc README.md +%license LICENSE + +%post -n %{crate} +/usr/bin/systemctl try-reload-or-restart sshd.service + +%postun -n %{crate} +if [ $1 == 0 ] ; then + /usr/bin/systemctl try-reload-or-restart sshd.service +fi + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +tar xvf %{SOURCE1} +mkdir -p .cargo +cat >.cargo/config << EOF +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF + + +%build +%cargo_build + +%install +%cargo_install +mkdir -p %{buildroot}%{_libexecdir} +mv %{_builddir}/ssh-key-dir-0.1.2/.cargo/bin/ssh-key-dir %{buildroot}%{_libexecdir} +install -Dpm0644 -t %{buildroot}%{_sysconfdir}/ssh/sshd_config.d conf/40-ssh-key-dir.conf + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Wed Jan 26 2022 duyiwei - 0.1.2-1 +- Package init \ No newline at end of file diff --git a/ssh-key-dir-0.1.2-vendor.tar.gz b/ssh-key-dir-0.1.2-vendor.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..3e5ce31504fb82bd9b4aacc55895c8e5aa1919f8 Binary files /dev/null and b/ssh-key-dir-0.1.2-vendor.tar.gz differ diff --git a/ssh-key-dir-0.1.2.crate b/ssh-key-dir-0.1.2.crate new file mode 100644 index 0000000000000000000000000000000000000000..eb6552e0d5ede1adfa6f66848365475783ce70d9 Binary files /dev/null and b/ssh-key-dir-0.1.2.crate differ