Blame afterburn.spec

b45c28
#
a123c5
# spec file for package afterburn
a123c5
#
31dd8c
# Copyright (c) 2022 SUSE LLC
a123c5
#
a123c5
# All modifications and additions to the file contributed by third parties
a123c5
# remain the property of their copyright owners, unless otherwise agreed
a123c5
# upon. The license for this file, and modifications and additions to the
a123c5
# file, is the same license as for the pristine package itself (unless the
a123c5
# license for the pristine package is not an Open Source License, in which
a123c5
# case the license is the MIT License). An "Open Source License" is a
a123c5
# license that conforms to the Open Source Definition (Version 1.9)
a123c5
# published by the Open Source Initiative.
a123c5
a123c5
# Please submit bugfixes or comments via https://bugs.opensuse.org/
a123c5
#
a123c5
b45c28
a123c5
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
b45c28
b45c28
%global dracutmodulesdir %(pkg-config --variable=dracutmodulesdir dracut || echo '/usr/lib/dracut/modules.d')
b45c28
b45c28
Name:           afterburn
b64dbb
Version:        5.3.0
b45c28
Release:        0
b45c28
Summary:        A cloud provider agent
b45c28
License:        Apache-2.0
b45c28
URL:            https://coreos.github.io/afterburn/
a9979f
Source0:        %{name}-%{version}.tar.xz
a9979f
Source1:        vendor.tar.xz
b45c28
Source2:        cargo_config
411df0
Patch1:         fix-authorized-keys-location.patch
411df0
Patch2:         set-default-user.patch
411df0
Patch3:         no-network-args.patch
b45c28
b9ce83
ExcludeArch:    %ix86 s390x ppc64le
a123c5
a123c5
BuildRequires:  cargo
b64dbb
BuildRequires:  rust >= 1.56.0
b45c28
BuildRequires:  pkgconfig(openssl)
a123c5
a123c5
%description
a123c5
Afterburn is a one-shot agent for cloud-like platforms which interacts with provider-specific metadata endpoints.
a123c5
b45c28
%package dracut
b45c28
Summary:        Dracut modules for afterburn
b45c28
BuildRequires:  pkgconfig(dracut)
b45c28
Requires:       %{name}%{?_isa} = %{?epoch:}%{version}-%{release}
b45c28
Requires:       dracut
b45c28
b45c28
%description dracut
b45c28
Dracut module that enables afterburn and corresponding services
b45c28
to run in the initramfs on boot.
b45c28
a123c5
%prep
411df0
%autosetup -N -a1
c0dab9
%patch1 -p1
411df0
%patch2 -p0
411df0
%patch3 -p0
411df0
a123c5
mkdir .cargo
a123c5
cp %{SOURCE2} .cargo/config
a123c5
# Remove exec bits to prevent an issue in fedora shebang checking
a123c5
find vendor -type f -name \*.rs -exec chmod -x '{}' +
a123c5
a123c5
%build
a123c5
export RUSTFLAGS="%{rustflags}"
a123c5
cargo build --offline --release
a123c5
a123c5
%install
a123c5
install -D -d -m 0755 %{buildroot}%{_bindir}
a123c5
install -D -d -m 0755 %{buildroot}%{_unitdir}
411df0
install -D -d -m 0755 %{buildroot}%{_sysconfdir}/cmdline.d
a123c5
a123c5
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name}
a9979f
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
a9979f
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-checkin.service %{buildroot}%{_unitdir}/%{name}-checkin.service
411df0
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-firstboot-checkin.service %{buildroot}%{_unitdir}/%{name}-firstboot-checkin.service
411df0
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys.target %{buildroot}%{_unitdir}/%{name}-sshkeys.target
411df0
sed -e 's,@DEFAULT_INSTANCE@,'suse',' < systemd/%{name}-sshkeys@.service.in > systemd/%{name}-sshkeys@.service.tmp
a123c5
mv systemd/%{name}-sshkeys@.service.tmp systemd/%{name}-sshkeys@.service
a9979f
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys@.service %{buildroot}%{_unitdir}/%{name}-sshkeys@.service
b45c28
mkdir -p %{buildroot}%{dracutmodulesdir}
b45c28
cp -a dracut/* %{buildroot}%{dracutmodulesdir}
411df0
rm %{buildroot}%{dracutmodulesdir}/30afterburn/afterburn-network-kargs.service
a123c5
a123c5
%pre
a9979f
%service_add_pre %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
a123c5
a123c5
%post
a9979f
%service_add_post %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
a123c5
a123c5
%preun
a9979f
%service_del_preun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
a123c5
a123c5
%postun
a9979f
%service_del_postun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
a123c5
a123c5
%files
a123c5
%license LICENSE
a123c5
%doc README.md
a123c5
%{_bindir}/afterburn
a123c5
%{_unitdir}/afterburn.service
a123c5
%{_unitdir}/afterburn-checkin.service
a123c5
%{_unitdir}/afterburn-firstboot-checkin.service
a123c5
%{_unitdir}/afterburn-sshkeys@.service
411df0
%{_unitdir}/%{name}-sshkeys.target
a123c5
b45c28
%files dracut
411df0
%dir %{_sysconfdir}/cmdline.d
b45c28
%{dracutmodulesdir}/30afterburn/
b45c28
a123c5
%changelog