rpm: build modules.img at package build time only on new system

Older mkfs.ext3 doesn't have -d option.
This in practice revert eb4c9ed "Build modules.img at module build time"
on older systems.
This commit is contained in:
Marek Marczykowski-Górecki 2019-03-16 00:04:36 +01:00
parent 00bbcc62b2
commit fd14ac930c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -404,6 +404,7 @@ cp -a %buildroot/lib/firmware/%kernelrelease %buildroot%vm_install_dir/modules/f
rm -f %buildroot%vm_install_dir/modules/%kernelrelease/build rm -f %buildroot%vm_install_dir/modules/%kernelrelease/build
cp -a %buildroot/%src_install_dir %buildroot%vm_install_dir/modules/%kernelrelease/build cp -a %buildroot/%src_install_dir %buildroot%vm_install_dir/modules/%kernelrelease/build
%if 0%{?fedora} >= 25
# include kernel+initramfs also inside modules.img, for direct kernel boot with # include kernel+initramfs also inside modules.img, for direct kernel boot with
# stubdomain # stubdomain
cp %buildroot%vm_install_dir/vmlinuz %buildroot%vm_install_dir/modules/ cp %buildroot%vm_install_dir/vmlinuz %buildroot%vm_install_dir/modules/
@ -416,6 +417,7 @@ PATH="/sbin:$PATH" mkfs.ext3 -d %buildroot%vm_install_dir/modules \
-U dcee2318-92bd-47a5-a15d-e79d1412cdce \ -U dcee2318-92bd-47a5-a15d-e79d1412cdce \
%buildroot%vm_install_dir/modules.img 500M %buildroot%vm_install_dir/modules.img 500M
rm -rf %buildroot%vm_install_dir/modules rm -rf %buildroot%vm_install_dir/modules
%endif
# remove files that will be auto generated by depmod at rpm -i time # remove files that will be auto generated by depmod at rpm -i time
for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
@ -526,6 +528,21 @@ Qubes domU kernel.
%post qubes-vm %post qubes-vm
%if 0%{?fedora} < 25
mkdir /tmp/qubes-modules-%kernelrelease
truncate -s 500M /tmp/qubes-modules-%kernelrelease.img
mkfs -t ext3 -F /tmp/qubes-modules-%kernelrelease.img > /dev/null
mount /tmp/qubes-modules-%kernelrelease.img /tmp/qubes-modules-%kernelrelease -o loop
cp -a -t /tmp/qubes-modules-%kernelrelease %vm_install_dir/modules/%kernelrelease
mkdir /tmp/qubes-modules-%kernelrelease/firmware
cp -a -t /tmp/qubes-modules-%kernelrelease/firmware %vm_install_dir/modules/firmware/%kernelrelease
cp %vm_install_dir/vmlinuz /tmp/qubes-modules-%kernelrelease/
cp %vm_install_dir/initramfs /tmp/qubes-modules-%kernelrelease/
umount /tmp/qubes-modules-%kernelrelease
rmdir /tmp/qubes-modules-%kernelrelease
mv /tmp/qubes-modules-%kernelrelease.img %vm_install_dir/modules.img
%endif
%if "%{name_suffix}" == "" %if "%{name_suffix}" == ""
# Set kernel as default VM kernel if we are the default package. # Set kernel as default VM kernel if we are the default package.
@ -552,9 +569,16 @@ exit 0
%files qubes-vm %files qubes-vm
%defattr(-, root, root) %defattr(-, root, root)
%dir %vm_install_dir %dir %vm_install_dir
%if 0%{?fedora} < 25
%ghost %attr(0644, root, root) %vm_install_dir/modules.img
%else
%attr(0644, root, root) %vm_install_dir/modules.img %attr(0644, root, root) %vm_install_dir/modules.img
%endif
%attr(0644, root, root) %vm_install_dir/initramfs %attr(0644, root, root) %vm_install_dir/initramfs
%attr(0644, root, root) %vm_install_dir/vmlinuz %attr(0644, root, root) %vm_install_dir/vmlinuz
%if 0%{?fedora} < 25
%vm_install_dir/modules
%endif
%attr(0644, root, root) %vm_install_dir/default-kernelopts-common.txt %attr(0644, root, root) %vm_install_dir/default-kernelopts-common.txt
%changelog %changelog