Compare commits
1 commit
rawhide
...
drop-insta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3922c1c5f |
4 changed files with 44 additions and 101 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 || "$(uname -m)" == riscv64 ]]
|
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]
|
||||||
then
|
then
|
||||||
COMMAND="$1"
|
COMMAND="$1"
|
||||||
KERNEL_VERSION="$2"
|
KERNEL_VERSION="$2"
|
||||||
|
|
|
||||||
76
grubby-bls
76
grubby-bls
|
|
@ -356,26 +356,22 @@ get_custom_bls_filename() {
|
||||||
prefix="${bls_target%%${arch}}"
|
prefix="${bls_target%%${arch}}"
|
||||||
prefix="${prefix%.*}"
|
prefix="${prefix%.*}"
|
||||||
|
|
||||||
first_gap=$(
|
last=($(for bls in ${prefix}.*~custom*.conf ; do
|
||||||
first=0
|
if ! [[ -e "${bls}" ]] ; then
|
||||||
for bls_entry in $(ls "${prefix}".*~custom*.conf 2>/dev/null | sort -V); do
|
continue
|
||||||
if [[ -e ${bls_entry} ]]; then
|
fi
|
||||||
bls_entry="${bls_entry##"${prefix}".}"
|
bls="${bls##${prefix}.}"
|
||||||
bls_entry="${bls_entry%%~custom*}"
|
bls="${bls%%~custom*}"
|
||||||
if [[ "${bls_entry}" = "${first}" ]]; then
|
echo "${bls}"
|
||||||
first=$((first+1))
|
done | tail -n1)) || :
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "${first}") || :
|
|
||||||
|
|
||||||
if [[ -z "$first_gap" ]]; then
|
if [[ -z $last ]]; then
|
||||||
first_gap="0"
|
last="0"
|
||||||
|
else
|
||||||
|
last=$((last+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${bls_target}" | sed -e "s!${prefix}!${prefix}.${first_gap}~custom!"
|
echo "${bls_target}" | sed -e "s!${prefix}!${prefix}.${last}~custom!"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_bls_fragment() {
|
add_bls_fragment() {
|
||||||
|
|
@ -504,7 +500,7 @@ update_bls_fragment() {
|
||||||
if [[ -n $old_args ]]; then
|
if [[ -n $old_args ]]; then
|
||||||
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||||
opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
|
opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
|
||||||
sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
|
sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -567,7 +563,7 @@ set_default_bls() {
|
||||||
echo "default=${default}" >> "${zipl_config}"
|
echo "default=${default}" >> "${zipl_config}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
update_grubcfg
|
|
||||||
print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
|
print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -599,29 +595,33 @@ remove_var_prefix() {
|
||||||
|
|
||||||
update_grubcfg()
|
update_grubcfg()
|
||||||
{
|
{
|
||||||
# Turn on RUN_MKCONFIG on different archs/scenarios
|
# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support
|
||||||
if [[ "${arch}" = 's390' ]] || [[ "${arch}" = 's390x' ]]; then
|
# so grub2-mkconfig has to be run to generate a config with menuentry commands.
|
||||||
# On s390/s390x systems, run mkconfig/zipl
|
if [ "${arch}" = "ppc64le" ] && [ -d /sys/firmware/opal ]; then
|
||||||
RUN_MKCONFIG="true"
|
RUN_MKCONFIG="true"
|
||||||
elif [[ "${arch}" = "ppc64le" ]] && [[ -d /sys/firmware/opal ]]; then
|
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
|
||||||
# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run
|
|
||||||
# to generate a config with menuentry commands.
|
if test -e ${petitboot_path}; then
|
||||||
RUN_MKCONFIG="true"
|
read -r -d '' petitboot_version < ${petitboot_path}
|
||||||
elif [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then
|
petitboot_version="$(echo ${petitboot_version//v})"
|
||||||
if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; then
|
|
||||||
# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support,
|
if test -n ${petitboot_version}; then
|
||||||
# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from
|
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
|
||||||
# 10_linux. So grub2-mkconfig has to run for both Xen Dom0 and DomU.
|
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
|
||||||
RUN_MKCONFIG=true
|
|
||||||
|
re='^[0-9]+$'
|
||||||
|
if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] &&
|
||||||
|
([[ ${major_version} -gt 1 ]] ||
|
||||||
|
[[ ${major_version} -eq 1 &&
|
||||||
|
${minor_version} -ge 8 ]]); then
|
||||||
|
RUN_MKCONFIG="false"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $RUN_MKCONFIG = "true" ]]; then
|
if [[ $RUN_MKCONFIG = "true" ]]; then
|
||||||
if [[ $bootloader = "zipl" ]]; then
|
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
|
||||||
zipl
|
|
||||||
else
|
|
||||||
grub2-mkconfig --no-grubenv-update -o "${grub_config}" &> /dev/null
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,7 +630,7 @@ print_usage()
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: grubby [OPTION...]
|
Usage: grubby [OPTION...]
|
||||||
--add-kernel=kernel-path add an entry for the specified kernel
|
--add-kernel=kernel-path add an entry for the specified kernel
|
||||||
--args=args default arguments for the new kernel or new arguments for kernel being updated
|
--args=args default arguments for the new kernel or new arguments for kernel being updated)
|
||||||
--bad-image-okay don't sanity check images in boot entries (for testing only)
|
--bad-image-okay don't sanity check images in boot entries (for testing only)
|
||||||
-c, --config-file=path path to grub config file to update ("-" for stdin)
|
-c, --config-file=path path to grub config file to update ("-" for stdin)
|
||||||
--copy-default use the default boot entry as a template for the new entry being added; if the default is not a linux image, or if the kernel referenced by the default image does not exist, the
|
--copy-default use the default boot entry as a template for the new entry being added; if the default is not a linux image, or if the kernel referenced by the default image does not exist, the
|
||||||
|
|
|
||||||
61
grubby.spec
61
grubby.spec
|
|
@ -3,16 +3,15 @@
|
||||||
|
|
||||||
Name: grubby
|
Name: grubby
|
||||||
Version: 8.40
|
Version: 8.40
|
||||||
Release: 86%{?dist}
|
Release: 71%{?dist}
|
||||||
Summary: Command line tool for updating bootloader configs
|
Summary: Command line tool for updating bootloader configs
|
||||||
License: GPL-2.0-or-later
|
License: GPLv2+
|
||||||
Source1: grubby-bls
|
Source1: grubby-bls
|
||||||
# Source2: rpm-sort.c
|
# Source2: rpm-sort.c
|
||||||
Source3: COPYING
|
Source3: COPYING
|
||||||
Source5: 95-kernel-hooks.install
|
Source5: 95-kernel-hooks.install
|
||||||
Source6: 10-devicetree.install
|
Source6: 10-devicetree.install
|
||||||
Source7: grubby.8
|
Source7: grubby.8
|
||||||
Source8: kernel.sysconfig
|
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: glib2-devel
|
BuildRequires: glib2-devel
|
||||||
|
|
@ -22,7 +21,7 @@ BuildRequires: pkgconfig
|
||||||
BuildRequires: popt-devel
|
BuildRequires: popt-devel
|
||||||
BuildRequires: rpm-devel
|
BuildRequires: rpm-devel
|
||||||
BuildRequires: sed
|
BuildRequires: sed
|
||||||
%ifarch aarch64 x86_64 %{power64} riscv64
|
%ifarch aarch64 x86_64 %{power64}
|
||||||
BuildRequires: grub2-tools-minimal
|
BuildRequires: grub2-tools-minimal
|
||||||
Requires: grub2-tools-minimal
|
Requires: grub2-tools-minimal
|
||||||
Requires: grub2-tools
|
Requires: grub2-tools
|
||||||
|
|
@ -60,9 +59,6 @@ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE6}
|
||||||
mkdir -p %{buildroot}%{_mandir}/man8
|
mkdir -p %{buildroot}%{_mandir}/man8
|
||||||
install -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man8/
|
install -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man8/
|
||||||
|
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
|
|
||||||
install -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/kernel
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if [ "$1" = 2 ]; then
|
if [ "$1" = 2 ]; then
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
|
|
@ -76,57 +72,10 @@ fi
|
||||||
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/10-devicetree.install
|
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/10-devicetree.install
|
||||||
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
|
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
|
||||||
%{_mandir}/man8/grubby.8*
|
%{_mandir}/man8/grubby.8*
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/kernel
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Dec 10 2025 Simon de Vlieger <cmdr@supakeen.com> - 8.40-86
|
* Thu Jun 22 2023 Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl> - 8.40-71
|
||||||
- Own `/etc/sysconfig/kernel` which is used for `grubby` configuration
|
- Drop installkernel so that it can by provided by systemd
|
||||||
|
|
||||||
* Wed Jul 30 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-85
|
|
||||||
- Update cfg when setting a default kernel
|
|
||||||
|
|
||||||
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-84
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Mar 20 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-83
|
|
||||||
- grubby-bls: in s390* systems, run zipl on grub cfg update event
|
|
||||||
Fixes previous commit and formats better the conditions that trigger grub cfg updates
|
|
||||||
|
|
||||||
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-82
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
|
||||||
|
|
||||||
* Mon Jan 06 2025 Nicolas Frayer <nfrayer@redhat.com> - 8.40-81
|
|
||||||
- Fixups to custom kernel targets
|
|
||||||
|
|
||||||
* Fri Dec 06 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-80
|
|
||||||
- grubby-bls: on PPC systems, remove petiboot's version checks
|
|
||||||
|
|
||||||
* Fri Dec 06 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-79
|
|
||||||
- grubby-bls: in s390* systems, run zipl on grub cfg update event
|
|
||||||
|
|
||||||
* Mon Dec 02 2024 David Abdurachmanov <davidlt@rivosinc.com> - 8.40-78
|
|
||||||
- Add riscv64 support
|
|
||||||
|
|
||||||
* Mon Nov 25 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-77
|
|
||||||
- On grub cfg updates, run grub2-mkconfig for Xen systems
|
|
||||||
|
|
||||||
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-76
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-75
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
|
||||||
|
|
||||||
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-74
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Jan 10 2024 Marta Lewandowska <mlewando@redhat.com> - 8.40-73
|
|
||||||
- Do not overwrite all vars that start with GRUB_CMDLINE_LINUX
|
|
||||||
|
|
||||||
* Mon Sep 11 2023 Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl> - 8.40-72
|
|
||||||
- Drop installkernel so that it can be provided by systemd
|
|
||||||
|
|
||||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-71
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
|
||||||
|
|
||||||
* Tue Feb 21 2023 Marta Lewandowska <mlewando@redhat.com> - 8.40-70
|
* Tue Feb 21 2023 Marta Lewandowska <mlewando@redhat.com> - 8.40-70
|
||||||
- remove root= when not copying default
|
- remove root= when not copying default
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# UPDATEDEFAULT specifies if kernel-install should make
|
|
||||||
# new kernels the default
|
|
||||||
UPDATEDEFAULT=yes
|
|
||||||
|
|
||||||
# DEFAULTKERNEL specifies the default kernel package type
|
|
||||||
DEFAULTKERNEL=kernel-core
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue