Revert "Don't harcode grub2 in the spec file"

Two issues:
- line 538 switches the filename from "grub" to "grub2" where it
  shouldn't
- in general, things that aren't referring to the packaging itself
  shouldn't be %{name}; it just makes them less flexible.

This reverts commit 967c5629ed.
This commit is contained in:
Peter Jones 2021-10-07 17:38:20 -04:00
parent 42a07486d8
commit af038a0bdc
2 changed files with 23 additions and 23 deletions

View file

@ -390,7 +390,7 @@ rm -f %{1}.conf \
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \
%{expand:%%define __pesign_client_cert %{name}-signer} \ %{expand:%%define __pesign_client_cert grub2-signer} \
%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \
%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \
%{nil} %{nil}
@ -534,9 +534,9 @@ fi \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
fi \ fi \
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
fi \ fi \
if [ %{3} -eq 0 ]; then \ if [ %{3} -eq 0 ]; then \
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
@ -555,8 +555,8 @@ fi \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
fi \ fi \
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
fi \ fi \
cd .. \ cd .. \
@ -573,7 +573,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
cp docs/grub-dev.info \\\ cp docs/grub-dev.info \\\
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \ $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
@ -583,7 +583,7 @@ ln -sf ../default/grub \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
ln -s ../boot/%{name}/grub.cfg \\\ ln -s ../boot/%{name}/grub.cfg \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg \ ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \
%{nil} %{nil}
%define define_legacy_variant_files() \ %define define_legacy_variant_files() \
@ -620,7 +620,7 @@ ln -s ../boot/%{name}/grub.cfg \\\
%dir %attr(0700,root,root)/boot/loader/entries \ %dir %attr(0700,root,root)/boot/loader/entries \
%ghost %config(noreplace) /boot/%{name}/grub.cfg \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
%config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
%{expand:%if 0%{?without_efi_modules} \ %{expand:%if 0%{?without_efi_modules} \
%exclude %{_libdir}/grub/%{6} \ %exclude %{_libdir}/grub/%{6} \

View file

@ -258,7 +258,7 @@ install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants
install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants
ln -s ../grub-boot-indeterminate.service \ ln -s ../grub-boot-indeterminate.service \
%{buildroot}%{_unitdir}/system-update.target.wants %{buildroot}%{_unitdir}/system-update.target.wants
ln -s ../%{name}-systemd-integration.service \ ln -s ../grub2-systemd-integration.service \
%{buildroot}%{_unitdir}/reboot.target.wants %{buildroot}%{_unitdir}/reboot.target.wants
# Don't run debuginfo on all the grub modules and whatnot; it just # Don't run debuginfo on all the grub modules and whatnot; it just
@ -283,9 +283,9 @@ ln -s ../%{name}-systemd-integration.service \
%undefine buildsubdir %undefine buildsubdir
%pre tools %pre tools
if [ -f /boot/%{name}/user.cfg ]; then if [ -f /boot/grub2/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' /boot/%{name}/user.cfg ; then if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/%{name}/user.cfg sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg
fi fi
elif [ -f %{efi_esp_dir}/user.cfg ]; then elif [ -f %{efi_esp_dir}/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' %{efi_esp_dir}/user.cfg ; then if grep -q '^GRUB_PASSWORD=' %{efi_esp_dir}/user.cfg ; then
@ -301,12 +301,12 @@ elif [ -f /etc/grub.d/01_users ] && \
sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \
> %{efi_esp_dir}/user.cfg > %{efi_esp_dir}/user.cfg
fi fi
if [ -f /boot/%{name}/grub.cfg ]; then if [ -f /boot/grub2/grub.cfg ]; then
install -m 0600 /dev/null /boot/%{name}/user.cfg install -m 0600 /dev/null /boot/grub2/user.cfg
chmod 0600 /boot/%{name}/user.cfg chmod 0600 /boot/grub2/user.cfg
grep '^password_pbkdf2 root' /etc/grub.d/01_users | \ grep '^password_pbkdf2 root' /etc/grub.d/01_users | \
sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \
> /boot/%{name}/user.cfg > /boot/grub2/user.cfg
fi fi
fi fi
@ -314,7 +314,7 @@ fi
set -eu set -eu
EFI_HOME=%{efi_esp_dir} EFI_HOME=%{efi_esp_dir}
GRUB_HOME=/boot/%{name} GRUB_HOME=/boot/grub2
ESP_PATH=/boot/efi ESP_PATH=/boot/efi
if ! mountpoint -q ${ESP_PATH}; then if ! mountpoint -q ${ESP_PATH}; then
@ -331,8 +331,8 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then
fi fi
# create a stub grub2 config in EFI # create a stub grub2 config in EFI
BOOT_UUID=$(%{name}-probe --target=fs_uuid ${GRUB_HOME}) BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME})
GRUB_DIR=$(%{name}-mkrelpath ${GRUB_HOME}) GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME})
cat << EOF > ${EFI_HOME}/grub.cfg.stb cat << EOF > ${EFI_HOME}/grub.cfg.stb
search --no-floppy --fs-uuid --set=dev ${BOOT_UUID} search --no-floppy --fs-uuid --set=dev ${BOOT_UUID}
@ -361,11 +361,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%dir /boot/%{name} %dir /boot/%{name}
%dir /boot/%{name}/themes/ %dir /boot/%{name}/themes/
%dir /boot/%{name}/themes/system %dir /boot/%{name}/themes/system
%attr(0700,root,root) %dir /boot/%{name} %attr(0700,root,root) %dir /boot/grub2
%exclude /boot/%{name}/* %exclude /boot/grub2/*
%dir %attr(0700,root,root) %{efi_esp_dir} %dir %attr(0700,root,root) %{efi_esp_dir}
%exclude %{efi_esp_dir}/* %exclude %{efi_esp_dir}/*
%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv %ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv
%license COPYING %license COPYING
%doc THANKS %doc THANKS
%doc docs/grub.html %doc docs/grub.html