# Generated by rust2rpm 25
%bcond_without check

# The library is for internal code reuse and is not a public API
%global cargo_install_lib 0

%global dracutlibdir %{_prefix}/lib/dracut
%global dracutcommit 09e3518fb6c49e0a14bf99eca5b9ab1e0ce672e1
%global dracutshortcommit %(c=%{dracutcommit}; echo ${c:0:7})

%global crate coreos-installer

Name:           rust-coreos-installer
Version: 0.23.0.94.gb5206fa
Release:        6%{?dist}
Summary:        Installer for Fedora CoreOS and RHEL CoreOS

License:        Apache-2.0
URL:            https://crates.io/crates/coreos-installer
Source0:        %{crates_source}
# not used on Fedora
# Source1:        https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz
Source2:        https://github.com/coreos/coreos-installer-dracut/archive/%{dracutcommit}/coreos-installer-dracut-%{dracutshortcommit}.tar.gz
ExcludeArch:    %{ix86}
# Patch0: 0001-signing-keys-add-Fedora-43-key.patch
# Patch1: 0002-signing-keys-drop-Fedora-40-key.patch

%if 0%{?rhel}
BuildRequires:  rust-toolset
BuildRequires:  openssl-devel
# To ensure we're not bundling system libraries
BuildRequires:  xz-devel
%else
BuildRequires:  cargo-rpm-macros >= 26
%endif

BuildRequires:  systemd-rpm-macros
BuildRequires:  libzstd-devel
# For tests
BuildRequires:  gnupg2

%global _description %{expand:
coreos-installer installs Fedora CoreOS or RHEL CoreOS to bare-metal
machines (or, occasionally, to virtual machines).}

%description %{_description}

%package     -n %{crate}
Summary:        %{summary}
# (Apache-2.0 OR MIT) AND BSD-3-Clause
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MIT OR Zlib OR Apache-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License:        Apache-2.0 AND BSD-3-Clause AND MIT AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown

Requires:       gnupg
Requires:       kpartx
Requires:       systemd-udev
Requires:       util-linux

%ifarch s390x
Requires:       s390utils-core
%endif

# Since `rust-coreos-installer` creates a `coreos-installer`
# subpackage with a newer version number, which supersedes the
# deprecated `coreos-installer` package (https://src.fedoraproject.org/rpms/coreos-installer),
# an explicit `Obsoletes:` for `coreos-installer` is not necessary.

# Obsolete dracut modules as they are not provided in this package.
Obsoletes:      coreos-installer-dracut < 0.0.1

%description -n %{crate} %{_description}

%files       -n %{crate}
%license LICENSE
%license LICENSE.dependencies
%if 0%{?rhel}
%license cargo-vendor.txt
%endif
%doc README.md
%{_bindir}/coreos-installer
%{_mandir}/man8/coreos-installer*
%dir %{_datadir}/coreos-installer
%{_datadir}/coreos-installer/example-config.yaml

%package     -n %{crate}-bootinfra
Summary:     %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS
# (Apache-2.0 OR MIT) AND BSD-3-Clause
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MIT OR Zlib OR Apache-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License:        Apache-2.0 AND BSD-3-Clause AND MIT AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown

Requires:    %{crate}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}

# Package was renamed from coreos-installer-systemd when rdcore was added
Provides:    %{crate}-systemd = %{version}-%{release}
Obsoletes:   %{crate}-systemd <= 0.3.0-3

%description -n %{crate}-bootinfra
This subpackage contains boot-time infrastructure for Fedora CoreOS and
RHEL CoreOS.  It is not needed on other platforms.

%files       -n %{crate}-bootinfra
%{dracutlibdir}/modules.d/50rdcore/
%{_libexecdir}/coreos-installer-*
%{_unitdir}/coreos-installer*.{service,target}
%{_systemdgeneratordir}/coreos-installer-generator

%package     -n %{crate}-dracut
Summary:     Dracut module for running coreos-installer in the initrd in IoT/Edge
Requires:    %{crate} = %{version}-%{release}

%description -n %{crate}-dracut
This subpackage contains files and configuration to run coreos-installer
from the initramfs in IoT/Edge and is supported by the community.

%files       -n %{crate}-dracut
%{dracutlibdir}/modules.d/51coreos-installer/

%prep
%autosetup -n %{crate}-%{version} -a 2 -p1
%if 0%{?rhel}
tar xf %{SOURCE1}
%cargo_prep -v vendor
%else
%cargo_prep
%endif

%if !0%{?rhel}
%generate_buildrequires
%cargo_generate_buildrequires -f rdcore
%endif

%build
%cargo_build -f rdcore
%{cargo_license_summary -f rdcore}
%{cargo_license -f rdcore} > LICENSE.dependencies
%if 0%{?rhel}
%cargo_vendor_manifest
%endif

%install
%cargo_install -f rdcore
# Install binaries, dracut modules, units, targets, generators for running via systemd
install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/50rdcore dracut/50rdcore/module-setup.sh
make install-scripts DESTDIR=%{buildroot}
make install-systemd DESTDIR=%{buildroot}
make install-man DESTDIR=%{buildroot}
make install-data DESTDIR=%{buildroot}
mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/

# 51coreos-installer for coreos-installer-dracut
%make_install -C coreos-installer-dracut-%{dracutcommit}

%if %{with check}
%check
%cargo_test -f rdcore
%endif

%changelog
* Thu Feb 10 2024 Sebastian Mayr <fedora@smayr.name> - 0.23.0-6
- Bump dracut version to 09e3518 to fix mmcblk/nvme device installs

* Thu Feb 06 2025 Aashish Radhakrishnan<aaradhak@redhat.com> - 0.23.0-5
- Backport patch that adds F43 signing key

* Thu Feb 06 2025 Fabio Valentini <decathorpe@gmail.com> - 0.23.0-4
- Rebuild for openssl crate >= v0.10.70 (RUSTSEC-2025-0004)

* Sun Jan 19 2025 Yaakov Selkowitz <yselkowi@redhat.com> - 0.23.0-3
- Update s390utils dependency

* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Wed Nov 13 2024 Packit <hello@packit.dev> - 0.23.0-1
- New upstream release

* Fri Sep 6 2024 Aashish Radhakrishnan<aaradhak@redhat.com> - 0.22.1-4
- Exclude ix86

* Thu Aug 22 2024 Huijing Hei <hhei@redhat.com> - 0.22.1-3
- Backport patch that adds the F42 signing key

* Wed Aug 14 2024 Huijing Hei <hhei@redhat.com> - 0.22.1-2
- Update ignition-config crate to latest

* Fri Jul 26 2024 Packit <hello@packit.dev> - 0.22.1-1
- New upstream release
- Drop too-strict dependencies patch. Fixed by:
  https://github.com/coreos/coreos-installer/pull/1453

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.21.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Thu May 23 2024 Fabio Valentini <decathorpe@gmail.com> - 0.21.0-3
- Rebuild with Rust 1.78 to fix incomplete debuginfo and backtraces.

* Sat Mar 30 2024 Fabio Valentini <decathorpe@gmail.com> - 0.21.0-2
- Relax too-strict dependencies to fix building with clap v4.5

* Thu Feb 22 2024 Packit <hello@packit.dev> - 0.21.0-1
- New upstream release

* Sun Feb 04 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 0.20.0-4
- Update Rust macro usage

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Tue Jan 09 2024 Fabio Valentini <decathorpe@gmail.com> - 0.20.0-2
- Refresh for latest Rust package template; update license tag for SPDX.

* Wed Dec 20 2023 Packit <hello@packit.dev> - 0.20.0-1
- New upstream release

* Thu Dec 07 2023 Steven Presti <spresti@redhat.com> - 0.18.0-3
- Remove rdcore patch, and move its logic into %prep

* Fri Dec 01 2023 Fabio Valentini <decathorpe@gmail.com> - 0.18.0-2
- Rebuild for openssl crate >= v0.10.60 (RUSTSEC-2023-0044, RUSTSEC-2023-0072)

* Fri Sep 8 2023 Nikita Dubrovskii <nikita@linux.ibm.com> - 0.18.0-1
- New release

* Mon Aug 14 2023 Aashish Radhakrishnan <aaradhak@redhat.com> - 0.17.0-5
- Backport patch that adds F40 signing key

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed May 03 2023 Fabio Valentini <decathorpe@gmail.com> - 0.17.0-3
- Rebuild for tokio, h2, and openssl crate security updates

* Tue Apr 11 2023 Irene Diez <idiez@redhat.com> - 0.17.0-2
- Update dracut/scripts: no need to mount the filesystem
  https://github.com/coreos/coreos-installer-dracut/pull/30

* Fri Mar 10 2023 Benjamin Gilbert <bgilbert@redhat.com> - 0.17.0-1
- New release

* Tue Feb 21 2023 Paul Whalen <pwhalen@fedoraproject.org> - 0.16.1-6
- Enable coreos-installer-dracut in Fedora

* Fri Feb 17 2023 Jonathan Lebon <jonathan@jlebon.com> - 0.16.1-5
- Backport patch that adds F39 signing key

* Sat Feb 04 2023 Fabio Valentini <decathorpe@gmail.com> - 0.16.1-4
- Rebuild for fixed frame pointer compiler flags in Rust RPM macros.

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Oct 14 2022 Benjamin Gilbert <bgilbert@redhat.com> - 0.16.1-2
- Build with mbrman 0.5.0

* Mon Sep 19 2022 Benjamin Gilbert <bgilbert@redhat.com> - 0.16.1-1
- New release
- Sync coreos-installer-dracut with CentOS Stream 9

* Thu Sep 15 2022 Steven Presti <spresti@redhat.com> - 0.16.0-1
- New release
- Add libzstd dependency

* Mon Aug 22 2022 Dusty Mabe <dusty@dustymabe.com> - 0.15.0-5
- Backport patch that adds F38 signing key

* Tue Aug 02 2022 Benjamin Gilbert <bgilbert@redhat.com> - 0.15.0-4
- Fix build with rust-bytes 1.2.0

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.15.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sun Jul 10 2022 Benjamin Gilbert <bgilbert@redhat.com> - 0.15.0-2
- Sync coreos-installer-dracut with CentOS Stream 9
- Fix build with rust-regex 1.6.0

* Fri Jun 17 2022 Michael Armijo <marmijo@redhat.com> - 0.15.0-1
- New release
- Install non-binary files using Makefile install targets
- Add man pages

* Wed Apr 27 2022 Jonathan Lebon <jonathan@jlebon.com> - 0.14.0-1
- New release

* Wed Mar 23 2022 Jonathan Lebon <jonathan@jlebon.com> - 0.13.1-3
- Backport "blockdev: rework EFI vendor dir checking"
  https://github.com/coreos/coreos-installer/pull/802 for
  https://github.com/coreos/fedora-coreos-tracker/issues/1116

* Tue Feb 15 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.13.1-2
- Rebuild with package notes

* Sun Feb 13 2022 Jonathan Lebon <jonathan@jlebon.com> - 0.13.1-1
- New release

* Thu Feb 10 2022 Jonathan Lebon <jonathan@jlebon.com> - 0.12.0-4
- Backport "signing-keys: regular Fedora cycle rotation of keys"
  https://github.com/coreos/coreos-installer/pull/770

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Mon Dec 20 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.12.0-2
- Unbundle serde_with and its dependencies

* Fri Dec 17 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.12.0-1
- New release
- Temporarily bundle serde_with and its dependencies
- Disable LTO to fix armv7hl builds

* Wed Dec 15 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.11.0-3
- Remove conditional around sourcing the vendor tarball
- Fix inadvertent inclusion of coreos-installer-dracut in -bootinfra on RHEL
- Have -dracut own 51coreos-installer directory on RHEL
- Bump coreos-installer-dracut

* Mon Nov 29 2021 Jonathan Lebon <jonathan@jlebon.com> - 0.11.0-2
- Backport "miniso: handle hardlinked files"
  https://github.com/coreos/coreos-installer/pull/694

* Thu Nov 18 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.11.0-1
- New release

* Thu Nov 04 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.10.1-3
- Vendor rust dependencies on RHEL only
- Add coreos-installer-dracut subpackage on RHEL only

* Tue Oct 12 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.10.1-2
- Rebuild for F33 bump

* Mon Oct 11 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.10.1-1
- New release

* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 0.10.0-3
- Rebuilt with OpenSSL 3.0.0

* Tue Aug 17 2021 Dusty Mabe <dusty@dustymabe.com> - 0.10.0-2
- Add F36 signing key

* Wed Aug 04 2021 Jonathan Lebon <jonathan@jlebon.com> - 0.10.0-1
- New release

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jul 13 2021 Jonathan Lebon <jonathan@jlebon.com> - 0.9.1-2
- Backport "install: restrict access permissions on /boot/ignition{,/config.ign}"
  https://github.com/coreos/coreos-installer/pull/571

* Mon May 17 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.9.1-1
- New release

* Thu Apr 08 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.9.0-2
- Fix dracut library path

* Thu Apr 08 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.9.0-1
- New release
- Fix hardcoded library path

* Tue Mar 16 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.8.0-1
- New release

* Mon Mar 01 2021 Fabio Valentini <decathorpe@gmail.com> - 0.7.2-5
- Backport trivial commit d94715c to allow building with nix 0.20.

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Mon Jan 04 2021 Benjamin Gilbert <bgilbert@redhat.com> - 0.7.2-3
- Add Requires for programs invoked by coreos-installer

* Mon Dec 28 13:28:50 CET 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.7.2-2
- Rebuild

* Thu Oct 22 2020 Sohan Kunkerkar <skunkerk@redhat.com> - 0.7.2-1
- New release

* Tue Oct 06 2020 Dusty Mabe <dusty@dustymabe.com> - 0.7.0-4
- Backport commit to start coreos-installer service after systemd-resolved
    - https://github.com/coreos/coreos-installer/pull/389

* Thu Oct 01 2020 Dusty Mabe <dusty@dustymabe.com> - 0.7.0-3
- Backport commit to add F33 and F34 keys. Drop F31 keys.
    - https://github.com/coreos/coreos-installer/pull/387

* Wed Sep 30 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.7.0-2
- Fix SIGSEGV in tests on s390x

* Mon Sep 21 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.7.0-1
- New release

* Tue Aug 25 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.6.0-1
- New release

* Sun Aug 16 15:01:11 GMT 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.5.0-2
- Rebuild

* Fri Jul 31 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.5.0-1
- New release

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Jul 24 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.4.0-1
- New release
- Rename -systemd subpackage to -bootinfra
- Add rdcore Dracut module to -bootinfra

* Fri Jul 24 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.3.0-2
- Rebuild

* Mon Jul 13 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.3.0-1
- New release

* Sat May 30 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.2.1-2
- Fixup license

* Fri May 29 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.2.1-1
- New release
- Make coreos-installer-{service,generator} world-readable

* Tue May 05 2020 Robert Fairley <rfairley@redhat.com> - 0.2.0-1
- Update to 0.2.0

* Sat Mar 21 2020 Benjamin Gilbert <bgilbert@redhat.com> - 0.1.3-1
- New release

* Fri Feb 21 2020 Josh Stone <jistone@redhat.com> - 0.1.2-4
- Bump to nix 0.17 and reqwest 0.10

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jan 09 2020 Josh Stone <jistone@redhat.com> - 0.1.2-2
- Remove the nix downgrade.

* Wed Jan 08 2020 Dusty Mabe <dusty@dustymabe.com> - 0.1.2-1
- Bump to new upstream release 0.1.2
    - Release notes: https://github.com/coreos/coreos-installer/releases/tag/v0.1.2
- Update spec file to include systemd units from upstream
    - These were added upstream in https://github.com/coreos/coreos-installer/pull/119

* Fri Dec 20 17:57:28 UTC 2019 Robert Fairley <rfairley@redhat.com> - 0.1.1-1
- Initial package