sysmaster/sysmaster.spec
2023-10-30 22:08:09 +08:00

238 lines
9.7 KiB
RPMSpec

%global __cargo_skip_build 0
%global _debugsource_packages 1
%global _debuginfo_subpackages 1
%define _unpackaged_files_terminate_build 0
%global sysmaster_install_source target/release
%global sysmaster_install_target %{buildroot}/usr/lib/sysmaster
%global unit_install_source units
%global unit_install_target %{sysmaster_install_target}/system
%global conf_install_source config/conf
%global devmaster_install_source target/release
%global devmaster_install_target %{buildroot}/usr/lib/devmaster
%global devmaster_conf_install_source exts/devmaster/config
%global devmaster_conf_install_target %{buildroot}/etc/devmaster
%global __cargo_common_opts %{?__cargo_common_opts} --all
%global _cargo_build /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo build %__cargo_common_opts
Name: sysmaster
Version: 0.5.1
Release: 2
Summary: redesign and reimplement process1.
License: Mulan PSL v2
URL: https://gitee.com/openeuler/sysmaster
Source0: %{name}-%{version}.tar.xz
Patch0: backport-fix-getty-generator-delelte-double-quote-in-the-conf.patch
ExclusiveArch: x86_64 aarch64
BuildRequires: rust cargo rust-packaging
BuildRequires: gcc clang openssl-libs
%description
redesign and reimplement process1.
Summary: %{summary}
%package -n devmaster
Summary: Infrastructure of device management in userspace.
BuildRequires: util-linux-devel kmod-devel
%description -n devmaster
This package provides the infrastructure of device management in userspace.
%prep
%autosetup -p1
%cargo_generate_buildrequires
%build
cat << EOF >> ./.cargo/config
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
%{_cargo_build} --profile release
%install
# For binary files and .so files, the permission 750 in the install phase to prevent objcopy errors.
# In the files phase, the permission is set back to 550.
install -Dm0750 -t %{buildroot}/usr/bin %{sysmaster_install_source}/sctl
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/init
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmaster
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/fstab
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/sysmonitor
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/random_seed
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/rc-local-generator
install -Dm0750 -t %{sysmaster_install_target} %{sysmaster_install_source}/hostname_setup
install -Dm0750 -t %{sysmaster_install_target}/system-generators %{sysmaster_install_source}/getty-generator
install -Dm0640 -t %{unit_install_target} %{unit_install_source}/*
install -Dm0640 -t %{buildroot}/etc/sysmaster %{conf_install_source}/system.conf
install -Dm0750 -t %{buildroot}/usr/bin %{devmaster_install_source}/devctl
install -Dm0550 -t %{devmaster_install_target} tools/run_with_devmaster/simulate_udev.sh
install -Dm0640 -t %{devmaster_conf_install_target} %{devmaster_conf_install_source}/config.toml
install -Dm0640 -t %{devmaster_conf_install_target}/rules.d %{devmaster_conf_install_source}/rules.d/*
install -Dm0640 -t %{devmaster_conf_install_target}/network.d %{devmaster_conf_install_source}/network.d/*
mkdir -p %{buildroot}/etc/sysmaster/system/multi-user.target.wants
mkdir -p %{buildroot}/etc/sysmaster/system/sysinit.target.wants
mkdir -p %{devmaster_install_target}
ln -s /usr/bin/devctl %{devmaster_install_target}/devmaster
for unit in NetworkManager.service dbus.service dbus.socket fstab.service hostname-setup.service udevd-control.socket udevd-kernel.socket; do
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/$unit
# enble service for booting
if [[ "$unit" == *".service" ]]; then
ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/multi-user.target.wants/$unit
fi
done
for unit in udevd.service udev-trigger.service; do
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/$unit
if [[ "$unit" == *".service" ]]; then
ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/sysinit.target.wants/$unit
fi
done
for unit in devmaster.service devctl-trigger.service; do
install -Dm0640 -t %{unit_install_target} tools/run_with_devmaster/service/$unit
if [[ "$unit" == *".service" ]]; then
ln -s /usr/lib/sysmaster/system/$unit %{buildroot}/etc/sysmaster/system/sysinit.target.wants/$unit
fi
done
install -Dm0640 -t %{unit_install_target} tools/run_with_devmaster/service/*.service
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/getty.target
ln -s /usr/lib/sysmaster/system//getty.target %{buildroot}/etc/sysmaster/system/multi-user.target.wants/getty.target
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/getty@.service
install -Dm0640 -t %{unit_install_target} tools/run_with_vm/serial-getty@.service
# Install compatible rules for lvm
install -Dm444 -t %{buildroot}/usr/lib/udev/rules.d rules/99-sysmaster.rules
# Install configurations under /etc.
install -Dm0640 -t %{devmaster_conf_install_target} %{devmaster_conf_install_source}/config.toml
sed -i 's/\"\/lib\/devmaster\/rules.d\"/&, \"\/etc\/udev\/rules.d\", \"\/run\/udev\/rules.d\", \"\/lib\/udev\/rules.d\"/' %{devmaster_conf_install_target}/config.toml
# enable sshd service by default
ln -s /usr/lib/sysmaster/system/sshd.service %{buildroot}/etc/sysmaster/system/multi-user.target.wants/sshd.service
%files
%attr(0550,-,-) /usr/bin/sctl
%dir %attr(0550,-,-) /usr/lib/sysmaster
%dir %attr(0750,-,-) /usr/lib/sysmaster/system
/usr/lib/sysmaster/system/*
%attr(0550,-,-) /usr/lib/sysmaster/init
%attr(0550,-,-) /usr/lib/sysmaster/fstab
%attr(0550,-,-) /usr/lib/sysmaster/sysmonitor
%attr(0550,-,-) /usr/lib/sysmaster/random_seed
%attr(0550,-,-) /usr/lib/sysmaster/rc-local-generator
%attr(0550,-,-) /usr/lib/sysmaster/system-generators/getty-generator
%attr(0550,-,-) /usr/lib/sysmaster/hostname_setup
%attr(0550,-,-) /usr/lib/sysmaster/sysmaster
%dir %attr(0750,-,-) /etc/sysmaster
%dir %attr(0750,-,-) /etc/sysmaster/system
%dir %attr(0750,-,-) /etc/sysmaster/system/multi-user.target.wants
%dir %attr(0750,-,-) /etc/sysmaster/system/sysinit.target.wants
/etc/sysmaster/system/multi-user.target.wants/*
/etc/sysmaster/system/sysinit.target.wants/*
/etc/sysmaster/system.conf
/usr/lib/udev/rules.d/99-sysmaster.rules
%exclude /usr/lib/sysmaster/system/devctl-trigger.service
%exclude /usr/lib/sysmaster/system/devmaster-simu-udev.service
%exclude /usr/lib/sysmaster/system/devmaster.service
%exclude /etc/sysmaster/system/sysinit.target.wants/devmaster.service
%exclude /etc/sysmaster/system/sysinit.target.wants/devctl-trigger.service
%files -n devmaster
%dir %attr(0550,-,-) /usr/lib/devmaster
%dir %attr(0750,-,-) /etc/devmaster
/etc/devmaster/config.toml
%dir %attr(0750,-,-) /etc/devmaster/rules.d
/etc/devmaster/rules.d/99-default.rules
%dir %attr(0750,-,-) /etc/devmaster/network.d
/etc/devmaster/network.d/99-default.link
%attr(0550,-,-) /usr/bin/devctl
%attr(0550,-,-) /usr/lib/devmaster/devmaster
/usr/lib/sysmaster/system/devctl-trigger.service
/usr/lib/sysmaster/system/devmaster-simu-udev.service
/usr/lib/sysmaster/system/devmaster.service
/usr/lib/devmaster/simulate_udev.sh
/etc/sysmaster/system/sysinit.target.wants/devmaster.service
/etc/sysmaster/system/sysinit.target.wants/devctl-trigger.service
%post -n devmaster
test -f /etc/sysmaster/system/sysinit.target.wants/udevd.service && unlink /etc/sysmaster/system/sysinit.target.wants/udevd.service
test -f /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service && unlink /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service
%postun -n devmaster
test -f /usr/lib/sysmaster/system/udevd.service && ln -s /usr/lib/sysmaster/system/udevd.service /etc/sysmaster/system/sysinit.target.wants/udevd.service
test -f /usr/lib/sysmaster/system/udev-trigger.service && ln -s /usr/lib/sysmaster/system/udev-trigger.service /etc/sysmaster/system/sysinit.target.wants/udev-trigger.service
%changelog
* Mon Oct 30 2023 zhangyao<zhangyao108@huawei.com> - 0.5.1-2
- add simulate_udev.sh file
* Mon Oct 30 2023 zhangyao<zhangyao108@huawei.com> - 0.5.1-1
- upgrade version to 0.5.1
* Fri Sep 01 2023 licunlong<licunlong1@huawei.com> - 0.2.5-4
- sync patchs from upstream
* Thu Aug 31 2023 licunlong<licunlong1@huawei.com> - 0.2.5-3
- log the status message to stdout
* Fri Aug 25 2023 licunlong<licunlong1@huawei.com> - 0.2.5-2
- sync patches from upstream
* Sat Aug 5 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.5-1
- update for compiling with rust 1.57
* Thu Jul 27 2023 huyubiao<huyubiao@huawei.com> - 0.2.4-5
- sync patches from upstream,
change the path of the unit,
modify permissions for some directories and files
* Wed Jul 19 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.4-4
- add compile option
* Thu Jul 06 2023 xujing<xujing125@huawei.com> - 0.2.4-3
- fix objcopy permission denied when rpmbuild
* Tue Jun 27 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.4-2
- modify the sshd units
* Tue Jun 20 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.4-1
- update version to 0.2.4 for docker use
* Fri Jun 16 2023 licunlong<licunlong1@huawei.com> - 0.2.3-3
- sync patches from upstream
* Tue May 30 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.3-2
- Support compatible compile with rust 1.60
* Sat May 6 2023 shenyangyang<shenyangyang4@huawei.com> - 0.2.3-1
- update version to 0.2.3
* Tue Sep 20 2022 licunlong<licunlong1@huawei.com> - 0.2.1-2
- rename process1 to sysmaster, and remove pctrl to /usr/bin
* Tue Sep 13 2022 licunlong<licunlong1@huawei.com> - 0.2.1-1
- sync patches from upstream
* Mon Aug 22 2022 He Xiaowen <hexiaowen@huawei.com> - 0.2.0-2
- strip the libraries
* Mon Aug 22 2022 He Xiaowen <hexiaowen@huawei.com> - 0.2.0-1
- initial package