improve master.inc

This commit is contained in:
Pratham Patel 2023-10-09 05:42:24 +05:30
parent 815c9a07d8
commit 605d2bbcc1
No known key found for this signature in database

View File

@ -123,6 +123,7 @@ echo "%{KVERREL}" > $RPM_BUILD_ROOT/boot/.uname-%{KVERREL}
# install DTBs
%ifarch aarch64 || riscv64
%{make} INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/boot/dtb-%{KVERREL} dtbs_install
# delete "arch/%{build_arch}/boot/dts" because "$PWD" will be packaged in "%devel"
find arch/%{build_arch}/boot/dts -name '*.dtb' -type f -delete
%endif
@ -172,19 +173,26 @@ if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KVERREL} -a -r /boot/System.ma
rm -f /boot/.vmlinuz-%{KVERREL}-rpm /boot/.System.map-%{KVERREL}-rpm
fi
# we pushd into /boot because we want our symlinks to be
# vmlinuz -> vmlinuz-6.6.0-20231004.6.el9.aarch64
# and not
# vmlinuz -> /boot/vmlinuz-6.6.0-20231004.6.el9.aarch64
pushd /boot
rm System.map vmlinuz
rm -vf .uname dtb initramfs.img System.map vmlinuz
ln -s .uname-%{KVERREL} .uname
ln -s dtb-%{KVERREL} dtb
ln -s initramfs-%{KVERREL}.img initramfs.img
ln -s System.map-%{KVERREL} System.map
ln -s vmlinuz-%{KVERREL} vmlinuz
popd
%preun
# remove symlinks
rm -vf /boot/.uname /boot/.uname-%{KVERREL}
rm -vf /boot/initramfs.img
rm -vf /boot/System.map
rm -vf /boot/vmlinuz
if [ -x /sbin/new-kernel-pkg ]; then
new-kernel-pkg --remove %{KVERREL} --rminitrd --initrdfile=/boot/initramfs-%{KVERREL}.img
elif [ -x /usr/bin/kernel-install ]; then
@ -195,6 +203,7 @@ fi
if [ -x /sbin/update-bootloader ]; then
/sbin/update-bootloader --remove %{KVERREL}
fi
[ -d /boot/dtb ] && rm -rf /boot/dtb
%files headers
%defattr (-, root, root)