2021-06-10 15:50:10 +02:00
|
|
|
#
|
2021-03-16 13:10:00 +01:00
|
|
|
# spec file for package afterburn
|
|
|
|
#
|
|
|
|
# Copyright (c) 2021 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/
|
|
|
|
#
|
|
|
|
|
2021-06-10 15:50:10 +02:00
|
|
|
|
2021-03-16 13:10:00 +01:00
|
|
|
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
|
2021-06-10 15:50:10 +02:00
|
|
|
|
|
|
|
%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/
|
2021-11-04 21:01:04 +01:00
|
|
|
Source0: %{name}-%{version}.tar.xz
|
|
|
|
Source1: vendor.tar.xz
|
2021-06-10 15:50:10 +02:00
|
|
|
Source2: cargo_config
|
2021-07-13 14:28:14 +02:00
|
|
|
Patch1: fix-authorized-keys-location.patch
|
|
|
|
Patch2: set-default-user.patch
|
|
|
|
Patch3: no-network-args.patch
|
2021-06-10 15:50:10 +02:00
|
|
|
|
2021-11-16 11:42:20 +01:00
|
|
|
ExcludeArch: %ix86 s390x ppc64le
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
BuildRequires: cargo
|
2021-05-21 09:58:04 +02:00
|
|
|
BuildRequires: rust >= 1.44.0
|
2021-06-10 15:50:10 +02:00
|
|
|
BuildRequires: pkgconfig(openssl)
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
Afterburn is a one-shot agent for cloud-like platforms which interacts with provider-specific metadata endpoints.
|
|
|
|
|
2021-06-10 15:50:10 +02:00
|
|
|
%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.
|
|
|
|
|
2021-03-16 13:10:00 +01:00
|
|
|
%prep
|
2021-07-13 14:28:14 +02:00
|
|
|
%autosetup -N -a1
|
|
|
|
%patch1 -p0
|
|
|
|
%patch2 -p0
|
|
|
|
%patch3 -p0
|
|
|
|
|
2021-03-16 13:10:00 +01:00
|
|
|
mkdir .cargo
|
|
|
|
cp %{SOURCE2} .cargo/config
|
|
|
|
# Remove exec bits to prevent an issue in fedora shebang checking
|
2021-03-18 13:54:05 +01:00
|
|
|
find vendor -type f -name \*.rs -exec chmod -x '{}' +
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%build
|
2021-03-18 13:54:05 +01:00
|
|
|
export RUSTFLAGS="%{rustflags}"
|
2021-03-16 13:10:00 +01:00
|
|
|
cargo build --offline --release
|
|
|
|
|
|
|
|
%install
|
|
|
|
install -D -d -m 0755 %{buildroot}%{_bindir}
|
|
|
|
install -D -d -m 0755 %{buildroot}%{_unitdir}
|
2021-07-13 14:28:14 +02:00
|
|
|
install -D -d -m 0755 %{buildroot}%{_sysconfdir}/cmdline.d
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name}
|
2021-11-04 21:01:04 +01:00
|
|
|
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
|
2021-07-13 14:28:14 +02:00
|
|
|
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
|
2021-03-16 13:10:00 +01:00
|
|
|
mv systemd/%{name}-sshkeys@.service.tmp systemd/%{name}-sshkeys@.service
|
2021-11-04 21:01:04 +01:00
|
|
|
install -m 0644 %{_builddir}/%{name}-%{version}/systemd/%{name}-sshkeys@.service %{buildroot}%{_unitdir}/%{name}-sshkeys@.service
|
2021-06-10 15:50:10 +02:00
|
|
|
mkdir -p %{buildroot}%{dracutmodulesdir}
|
|
|
|
cp -a dracut/* %{buildroot}%{dracutmodulesdir}
|
2021-07-13 14:28:14 +02:00
|
|
|
rm %{buildroot}%{dracutmodulesdir}/30afterburn/afterburn-network-kargs.service
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%pre
|
2021-11-04 21:01:04 +01:00
|
|
|
%service_add_pre %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%post
|
2021-11-04 21:01:04 +01:00
|
|
|
%service_add_post %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%preun
|
2021-11-04 21:01:04 +01:00
|
|
|
%service_del_preun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%postun
|
2021-11-04 21:01:04 +01:00
|
|
|
%service_del_postun %{name}.service %{name}-checkin.service %{name}-firstboot-checkin.service %{name}-sshkeys@.service
|
2021-03-16 13:10:00 +01:00
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE
|
|
|
|
%doc README.md
|
|
|
|
%{_bindir}/afterburn
|
|
|
|
%{_unitdir}/afterburn.service
|
|
|
|
%{_unitdir}/afterburn-checkin.service
|
|
|
|
%{_unitdir}/afterburn-firstboot-checkin.service
|
|
|
|
%{_unitdir}/afterburn-sshkeys@.service
|
2021-07-13 14:28:14 +02:00
|
|
|
%{_unitdir}/%{name}-sshkeys.target
|
2021-03-16 13:10:00 +01:00
|
|
|
|
2021-06-10 15:50:10 +02:00
|
|
|
%files dracut
|
2021-07-13 14:28:14 +02:00
|
|
|
%dir %{_sysconfdir}/cmdline.d
|
2021-06-10 15:50:10 +02:00
|
|
|
%{dracutmodulesdir}/30afterburn/
|
|
|
|
|
2021-03-16 13:10:00 +01:00
|
|
|
%changelog
|