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:
parent
5e2444babe
commit
967c5629ed
18
grub.macros
18
grub.macros
@ -389,7 +389,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 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 %%{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}
|
||||||
@ -533,9 +533,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}/grub2.chrp ]; then \
|
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
|
||||||
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\
|
||||||
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.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 \\\
|
||||||
@ -554,8 +554,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}/grub2.chrp ]; then \
|
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \
|
||||||
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\
|
||||||
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
||||||
fi \
|
fi \
|
||||||
cd .. \
|
cd .. \
|
||||||
@ -572,7 +572,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/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/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 \
|
||||||
@ -582,7 +582,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}/grub2.cfg \
|
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
%define define_legacy_variant_files() \
|
%define define_legacy_variant_files() \
|
||||||
@ -619,7 +619,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/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 \
|
%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} \
|
||||||
|
28
grub2.spec
28
grub2.spec
@ -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 ../grub2-systemd-integration.service \
|
ln -s ../%{name}-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 ../grub2-systemd-integration.service \
|
|||||||
%undefine buildsubdir
|
%undefine buildsubdir
|
||||||
|
|
||||||
%pre tools
|
%pre tools
|
||||||
if [ -f /boot/grub2/user.cfg ]; then
|
if [ -f /boot/%{name}/user.cfg ]; then
|
||||||
if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then
|
if grep -q '^GRUB_PASSWORD=' /boot/%{name}/user.cfg ; then
|
||||||
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg
|
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/%{name}/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/grub2/grub.cfg ]; then
|
if [ -f /boot/%{name}/grub.cfg ]; then
|
||||||
install -m 0600 /dev/null /boot/grub2/user.cfg
|
install -m 0600 /dev/null /boot/%{name}/user.cfg
|
||||||
chmod 0600 /boot/grub2/user.cfg
|
chmod 0600 /boot/%{name}/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/grub2/user.cfg
|
> /boot/%{name}/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/grub2
|
GRUB_HOME=/boot/%{name}
|
||||||
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=$(grub2-probe --target=fs_uuid ${GRUB_HOME})
|
BOOT_UUID=$(%{name}-probe --target=fs_uuid ${GRUB_HOME})
|
||||||
GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME})
|
GRUB_DIR=$(%{name}-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/grub2
|
%attr(0700,root,root) %dir /boot/%{name}
|
||||||
%exclude /boot/grub2/*
|
%exclude /boot/%{name}/*
|
||||||
%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/grub2/grubenv
|
%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv
|
||||||
%license COPYING
|
%license COPYING
|
||||||
%doc THANKS
|
%doc THANKS
|
||||||
%doc docs/grub.html
|
%doc docs/grub.html
|
||||||
|
Loading…
Reference in New Issue
Block a user