%bcond_without check %global dracutlibdir %{_prefix}/lib/dracut %global crate afterburn Name: rust-%{crate} Version: 4.3.3 Release: 1.rhaos4.4%{?dist} Summary: Simple cloud provider agent License: ASL 2.0 URL: https://github.com/coreos/afterburn Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate Source1: https://github.com/coreos/afterburn/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz ExclusiveArch: %{rust_arches} Patch0: 0001-Dracut-change-module-setup-for-rhcos.patch BuildRequires: rust-toolset BuildRequires: openssl-devel BuildRequires: systemd Requires: dracut %description %{summary}. %package -n %{crate} Summary: %{summary} %description -n %{crate} %{summary}. %prep %autosetup -n %{crate}-%{version} -p1 # afterburn-sshkeys@.service is by default enabled for the 'core' user in # RHEL CoreOS. # Based on https://github.com/coreos/afterburn/blob/master/Makefile. sed -e 's,@DEFAULT_INSTANCE@,core,' < \ systemd/afterburn-sshkeys@.service.in > \ systemd/afterburn-sshkeys@.service # Source1 is vendored dependencies, need -V otherwise cargo tries (and fails) # to fetch from upstream. %cargo_prep -V 1 # https://github.com/rust-lang-nursery/error-chain/pull/289 find -name '*.rs' -executable -exec chmod a-x {} \; %build %cargo_build %install %cargo_install %{__install} -Dpm0644 -t %{buildroot}%{_unitdir} \ systemd/*.service # dracut install -d -p %{buildroot}/%{dracutlibdir}/modules.d cp -r dracut/* %{buildroot}/%{dracutlibdir}/modules.d/ %if %{with check} %check %cargo_test %endif %post -n %{crate} %systemd_post afterburn.service %systemd_post afterburn-checkin.service %systemd_post afterburn-firstboot-checkin.service %systemd_post afterburn-sshkeys@.service %preun -n %{crate} %systemd_preun afterburn.service %systemd_preun afterburn-checkin.service %systemd_preun afterburn-firstboot-checkin.service %systemd_preun afterburn-sshkeys@.service %postun -n %{crate} %systemd_postun afterburn.service %systemd_postun afterburn-checkin.service %systemd_postun afterburn-firstboot-checkin.service %systemd_postun afterburn-sshkeys@.service %files -n %{crate} %license LICENSE %doc README.md %{_bindir}/afterburn %{_unitdir}/afterburn.service %{_unitdir}/afterburn-checkin.service %{_unitdir}/afterburn-firstboot-checkin.service %{_unitdir}/afterburn-sshkeys@.service %{dracutlibdir}/modules.d/30afterburn/afterburn-hostname.service %{dracutlibdir}/modules.d/30afterburn/module-setup.sh %changelog * Wed May 6 2020 Robert Fairley - 4.3.3-1 - Update to 4.3.3 * Wed Jul 17 2019 Yu Qi Zhang - 4.1.1-3 - Add patch for relabelling hostname file * Tue Jul 16 2019 Yu Qi Zhang - 4.1.1-2 - Add patch for RHCOS to link afterburn-hostname to ignition-files * Fri Jun 21 2019 Steve Milner - 4.1.1-1 - Update for upstream release - Add 30afterburn for dracut * Wed May 22 2019 Yu Qi Zhang - 4.1.0-1 - Initial package imported from upstream