init package

This commit is contained in:
duyiwei 2022-03-17 17:06:29 +08:00
parent 76d3f97ff1
commit 795bd9d81f
4 changed files with 123 additions and 0 deletions

BIN
.nestos-installer.spec.swp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

123
nestos-installer.spec Normal file
View File

@ -0,0 +1,123 @@
%define dracutlibdir %{_prefix}/lib/dracut
%bcond_without check
%define debug_package %{nil}
%global __cargo_skip_build 0
# The library is for internal code reuse and is not a public API
%global __cargo_is_lib 0
%global crate nestos-installer
Name: rust-nestos-installer
Version: 0.10.0
Release: 1
Summary: Installer for NestOS
# Upstream license specification: Apache-2.0
License: ASL 2.0
URL: https://gitee.com/openeuler/nestos-installer
Source0: https://gitee.com/openeuler/%{crate}/blob/master/%{crate}-%{version}.crate.tar.gz
Source1: https://gitee.com/openeuler/%{crate}/blob/master/%{crate}-%{version}-vendor.tar.gz
BuildRequires: rust-packaging openssl-devel
BuildRequires: systemd
%global _description %{expand:
nestos-installer installs NestOS to bare-metal
machines (or, occasionally, to virtual machines).
}
%description %{_description}
%package -n nestos-installer
Summary: %{summary}
License: ASL 2.0 and MIT and zlib
Requires: gnupg
Requires: kpartx
Requires: systemd-udev
Requires: util-linux
%ifarch s390x
# This should be spelled "s390utils-core" but some of the binaries are
# still moving over from s390utils-base
Requires: /usr/sbin/chreipl
Requires: /usr/sbin/dasdfmt
Requires: /usr/sbin/fdasd
Requires: /usr/sbin/lszdev
Requires: /usr/sbin/zipl
%endif
# Since `rust-nestos-installer` creates a `nestos-installer`
# subpackage with a newer version number, which supersedes the
# deprecated `nestos-installer` package ,
# an explicit `Obsoletes:` for `nestos-installer` is not necessary.
# Obsolete dracut modules as they are not provided in this package.
Obsoletes: nestos-installer-dracut < 0.0.1
%description -n nestos-installer %{_description}
%files -n nestos-installer
%license LICENSE
%doc Readme.md
%{_bindir}/nestos-installer
%prep
%autosetup -n %{crate}-%{version} -p1
tar xvf %{SOURCE1}
%cargo_prep
sed -i 's/"-Ccodegen-units=1",//' .cargo/config
mkdir -p .cargo
cat >.cargo/config << EOF
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
%build
%cargo_build -f rdcore
%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
install -D -m 0755 -t %{buildroot}%{_libexecdir} scripts/nestos-installer-service
install -D -m 0755 -t %{buildroot}%{_libexecdir} scripts/nestos-installer-disable-device-auto-activation
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer-disable-device-auto-activation.service
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer.service
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer-reboot.service
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer-noreboot.service
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer-pre.target
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer.target
install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/nestos-installer-post.target
install -D -m 0755 -t %{buildroot}%{_systemdgeneratordir} systemd/nestos-installer-generator
cp -r $RPM_BUILD_DIR/%{crate}-%{version}/.cargo/bin %{buildroot}/usr
mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/
%package -n nestos-installer-bootinfra
Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS
Requires: %{crate}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
License: ASL 2.0 and MIT and zlib
Provides: %{crate}-systemd = %{version}-%{release}
Obsoletes: %{crate}-systemd <= 0.3.0-3
%description -n %{crate}-bootinfra
This subpackage contains boot-time infrastructure for NestOS. It is not needed on other platforms.
%files -n %{crate}-bootinfra
%{dracutlibdir}/modules.d/*
%{_libexecdir}/*
%{_unitdir}/*
%{_systemdgeneratordir}/*
%changelog
* Thu Mar 17 2022 duyiwei <duyiwei@kylinos.cn> - 0.10.1-1
- init package