Don't harcode grub2 in the spec file

There's a variable for this, use it consistently.

Suggested-by: Benjamin Herrenschmidt <benh@amazon.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2021-06-30 09:20:25 +02:00
parent 5e2444babe
commit 967c5629ed
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
2 changed files with 23 additions and 23 deletions

View File

@ -389,7 +389,7 @@ rm -f %{1}.conf \
%{?__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 %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \
%{expand:%%define __pesign_client_cert grub2-signer} \
%{expand:%%define __pesign_client_cert %{name}-signer} \
%{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}}} \
%{nil}
@ -533,9 +533,9 @@ fi \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
fi \
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \
fi \
if [ %{3} -eq 0 ]; then \
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
@ -554,8 +554,8 @@ fi \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
fi \
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
fi \
cd .. \
@ -572,7 +572,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
cp docs/grub-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}/boot/grub2/ \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/ \
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}%{_sysconfdir}/default \
@ -582,7 +582,7 @@ ln -sf ../default/grub \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
ln -s ../boot/%{name}/grub.cfg \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg \
%{nil}
%define define_legacy_variant_files() \
@ -619,7 +619,7 @@ ln -s ../boot/%{name}/grub.cfg \\\
%dir %attr(0700,root,root)/boot/loader/entries \
%ghost %config(noreplace) /boot/%{name}/grub.cfg \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \
%config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv \
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
%{expand:%if 0%{?without_efi_modules} \
%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
ln -s ../grub-boot-indeterminate.service \
%{buildroot}%{_unitdir}/system-update.target.wants
ln -s ../grub2-systemd-integration.service \
ln -s ../%{name}-systemd-integration.service \
%{buildroot}%{_unitdir}/reboot.target.wants
# Don't run debuginfo on all the grub modules and whatnot; it just
@ -283,9 +283,9 @@ ln -s ../grub2-systemd-integration.service \
%undefine buildsubdir
%pre tools
if [ -f /boot/grub2/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg
if [ -f /boot/%{name}/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' /boot/%{name}/user.cfg ; then
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/%{name}/user.cfg
fi
elif [ -f %{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/' \
> %{efi_esp_dir}/user.cfg
fi
if [ -f /boot/grub2/grub.cfg ]; then
install -m 0600 /dev/null /boot/grub2/user.cfg
chmod 0600 /boot/grub2/user.cfg
if [ -f /boot/%{name}/grub.cfg ]; then
install -m 0600 /dev/null /boot/%{name}/user.cfg
chmod 0600 /boot/%{name}/user.cfg
grep '^password_pbkdf2 root' /etc/grub.d/01_users | \
sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \
> /boot/grub2/user.cfg
> /boot/%{name}/user.cfg
fi
fi
@ -314,7 +314,7 @@ fi
set -eu
EFI_HOME=%{efi_esp_dir}
GRUB_HOME=/boot/grub2
GRUB_HOME=/boot/%{name}
ESP_PATH=/boot/efi
if ! mountpoint -q ${ESP_PATH}; then
@ -331,8 +331,8 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then
fi
# create a stub grub2 config in EFI
BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME})
GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME})
BOOT_UUID=$(%{name}-probe --target=fs_uuid ${GRUB_HOME})
GRUB_DIR=$(%{name}-mkrelpath ${GRUB_HOME})
cat << EOF > ${EFI_HOME}/grub.cfg.stb
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}/themes/
%dir /boot/%{name}/themes/system
%attr(0700,root,root) %dir /boot/grub2
%exclude /boot/grub2/*
%attr(0700,root,root) %dir /boot/%{name}
%exclude /boot/%{name}/*
%dir %attr(0700,root,root) %{efi_esp_dir}
%exclude %{efi_esp_dir}/*
%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv
%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv
%license COPYING
%doc THANKS
%doc docs/grub.html