afterburn/afterburn.spec
Darragh O'Reilly 880236d29f Accepting request 946285 from home:jzerebecki:branches:devel:kubic:ignition
- Update some dependencies
  * build(deps): bump nix from 0.17.0 and 0.20.0 to 0.23.1
    This fixes the following security issues:
    https://rustsec.org/advisories/RUSTSEC-2021-0119
  * build(deps): bump generic-array from 0.12.3 to 0.12.4
    This fixes a security issue:
    https://rustsec.org/advisories/RUSTSEC-2020-0146 AKA CVE-2020-36465
  * build(deps): bump futures-util from 0.3.6 to 0.3.15
    This fixes a security issue:
    https://rustsec.org/advisories/RUSTSEC-2020-0059 AKA CVE-2020-35905
  * build(deps): bump rand_core from 0.6.1 to 0.6.3
    This fixes a security issue:
    https://rustsec.org/advisories/RUSTSEC-2021-0023
    AKA CVE-2021-27378, bsc#1182432
  * build(deps): bump hyper from 0.14.2 to 0.14.11
    This fixes two security issues:
    https://rustsec.org/advisories/RUSTSEC-2021-0078
    AKA CVE-2021-32715, bsc#1188173
    https://rustsec.org/advisories/RUSTSEC-2021-0079
    AKA CVE-2021-32714, bsc#1188174
  * build(deps): bump tokio from 1.0.1 to 1.15.0
    This fixes two security issues:
    https://rustsec.org/advisories/RUSTSEC-2021-0124
    AKA CVE-2021-45710, bsc#1194119
    https://rustsec.org/advisories/RUSTSEC-2021-0072 AKA CVE-2021-38191
- Remove cargo_audit service, as it makes no sense as a service (it doesn't
  automatically get rerun), it would make more sense during the build process
  as then it gets rerun if the package or the vulnerability database get
  changed
- switch services from disabled to manual

OBS-URL: https://build.opensuse.org/request/show/946285
OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/afterburn?expand=0&rev=15
2022-01-18 20:29:32 +00:00

114 lines
4.1 KiB
RPMSpec

#
# spec file for package afterburn
#
# Copyright (c) 2022 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/
#
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
%global dracutmodulesdir %(pkg-config --variable=dracutmodulesdir dracut || echo '/usr/lib/dracut/modules.d')
Name: afterburn
Version: 5.0.0
Release: 0
Summary: A cloud provider agent
License: Apache-2.0
URL: https://coreos.github.io/afterburn/
Source0: %{name}-%{version}.tar.xz
Source1: vendor.tar.xz
Source2: cargo_config
Patch1: fix-authorized-keys-location.patch
Patch2: set-default-user.patch
Patch3: no-network-args.patch
ExcludeArch: %ix86 s390x ppc64le
BuildRequires: cargo
BuildRequires: rust >= 1.44.0
BuildRequires: pkgconfig(openssl)
%description
Afterburn is a one-shot agent for cloud-like platforms which interacts with provider-specific metadata endpoints.
%package dracut
Summary: Dracut modules for afterburn
BuildRequires: pkgconfig(dracut)
Requires: %{name}%{?_isa} = %{?epoch:}%{version}-%{release}
Requires: dracut
%description dracut
Dracut module that enables afterburn and corresponding services
to run in the initramfs on boot.
%prep
%autosetup -N -a1
%patch1 -p0
%patch2 -p0
%patch3 -p0
mkdir .cargo
cp %{SOURCE2} .cargo/config
# Remove exec bits to prevent an issue in fedora shebang checking
find vendor -type f -name \*.rs -exec chmod -x '{}' +
%build
export RUSTFLAGS="%{rustflags}"
cargo build --offline --release
%install
install -D -d -m 0755 %{buildroot}%{_bindir}
install -D -d -m 0755 %{buildroot}%{_unitdir}
install -D -d -m 0755 %{buildroot}%{_sysconfdir}/cmdline.d
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name}
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-checkin.service %{buildroot}%{_unitdir}/%{name}-checkin.service
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-firstboot-checkin.service %{buildroot}%{_unitdir}/%{name}-firstboot-checkin.service
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys.target %{buildroot}%{_unitdir}/%{name}-sshkeys.target
sed -e 's,@DEFAULT_INSTANCE@,'suse',' < systemd/%{name}-sshkeys@.service.in > systemd/%{name}-sshkeys@.service.tmp
mv systemd/%{name}-sshkeys@.service.tmp systemd/%{name}-sshkeys@.service
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys@.service %{buildroot}%{_unitdir}/%{name}-sshkeys@.service
mkdir -p %{buildroot}%{dracutmodulesdir}
cp -a dracut/* %{buildroot}%{dracutmodulesdir}
rm %{buildroot}%{dracutmodulesdir}/30afterburn/afterburn-network-kargs.service
%pre
%service_add_pre %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
%post
%service_add_post %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
%preun
%service_del_preun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
%postun
%service_del_postun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
%files
%license LICENSE
%doc README.md
%{_bindir}/afterburn
%{_unitdir}/afterburn.service
%{_unitdir}/afterburn-checkin.service
%{_unitdir}/afterburn-firstboot-checkin.service
%{_unitdir}/afterburn-sshkeys@.service
%{_unitdir}/%{name}-sshkeys.target
%files dracut
%dir %{_sysconfdir}/cmdline.d
%{dracutmodulesdir}/30afterburn/
%changelog