Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
12e62c4f0a | ||
|
770392fcd0 | ||
|
959c481fa9 | ||
|
b2ab29059a | ||
|
f24781c87b | ||
|
b1eee22db8 | ||
|
1621d288b6 | ||
|
670185c682 | ||
|
303821d014 | ||
|
f57406f3ab | ||
|
8c7d866907 | ||
|
5f9558c222 | ||
|
03b13cef75 | ||
|
b5070e2278 | ||
|
3ffa2d2706 | ||
|
08153fc1d6 | ||
|
5dafc374ee | ||
|
77a8c0bcac | ||
|
9baffd002d | ||
|
4009bc7ed4 | ||
|
b50c79e71c | ||
|
7c6e97e809 | ||
|
7b4b34aa74 | ||
|
73b809baaf | ||
|
dc24f2cedf | ||
|
8213073fa4 | ||
|
6abeb6fc77 |
@ -1,5 +1,5 @@
|
||||
From 00241c65a5c0b4bb32a847a6abb5a86d0c704a8f Mon Sep 17 00:00:00 2001
|
||||
From: no one <noone@example.com>
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 5 Feb 2019 20:08:43 +0100
|
||||
Subject: [PATCH] Fix GCC warnings about possible string truncations and buffer
|
||||
overflows
|
||||
@ -10,7 +10,7 @@ leads to GCC complaining about possible string truncation and overflows.
|
||||
Fix this by using memcpy(), explicitly calculating the buffers lenghts
|
||||
and set a NUL byte terminator after copying the buffers.
|
||||
|
||||
Signed-off-by: no one <noone@example.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 35 +++++++++++++++++++++++++++--------
|
||||
1 file changed, 27 insertions(+), 8 deletions(-)
|
||||
|
72
0011-Fix-stringop-overflow-warning.patch
Normal file
72
0011-Fix-stringop-overflow-warning.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From ed5e255c023c9b78120d9ff2246d6516f652d4b7 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 19:32:39 +0100
|
||||
Subject: [PATCH] Fix stringop-overflow warning
|
||||
|
||||
GCC gives the following compile warning:
|
||||
|
||||
grubby.c: In function 'main':
|
||||
grubby.c:4508:27: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
|
||||
4508 | saved_command_line[0] = '\0';
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
|
||||
grubby.c:4503:26: note: at offset 0 to an object with size 0 allocated by 'malloc' here
|
||||
4503 | saved_command_line = malloc(i);
|
||||
| ^~~~~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
make: *** [Makefile:38: grubby.o] Error 1
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 35 +++++++++++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 5ca689539cf..0c0f67a0ae5 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -4500,23 +4500,26 @@ int main(int argc, const char ** argv) {
|
||||
int i = 0;
|
||||
for (int j = 1; j < argc; j++)
|
||||
i += strlen(argv[j]) + 1;
|
||||
- saved_command_line = malloc(i);
|
||||
- if (!saved_command_line) {
|
||||
- fprintf(stderr, "grubby: %m\n");
|
||||
- exit(1);
|
||||
- }
|
||||
- saved_command_line[0] = '\0';
|
||||
- int cmdline_len = 0, arg_len;
|
||||
- for (int j = 1; j < argc; j++) {
|
||||
- arg_len = strlen(argv[j]);
|
||||
- memcpy(saved_command_line + cmdline_len, argv[j], arg_len);
|
||||
- cmdline_len += arg_len;
|
||||
- if (j != argc - 1) {
|
||||
- memcpy(saved_command_line + cmdline_len, " ", 1);
|
||||
- cmdline_len++;
|
||||
- }
|
||||
+
|
||||
+ if (i > 0) {
|
||||
+ saved_command_line = malloc(i);
|
||||
+ if (!saved_command_line) {
|
||||
+ fprintf(stderr, "grubby: %m\n");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ saved_command_line[0] = '\0';
|
||||
+ int cmdline_len = 0, arg_len;
|
||||
+ for (int j = 1; j < argc; j++) {
|
||||
+ arg_len = strlen(argv[j]);
|
||||
+ memcpy(saved_command_line + cmdline_len, argv[j], arg_len);
|
||||
+ cmdline_len += arg_len;
|
||||
+ if (j != argc - 1) {
|
||||
+ memcpy(saved_command_line + cmdline_len, " ", 1);
|
||||
+ cmdline_len++;
|
||||
+ }
|
||||
+ }
|
||||
+ saved_command_line[cmdline_len] = '\0';
|
||||
}
|
||||
- saved_command_line[cmdline_len] = '\0';
|
||||
|
||||
optCon = poptGetContext("grubby", argc, argv, options, 0);
|
||||
poptReadDefaultConfig(optCon, 1);
|
||||
--
|
||||
2.24.1
|
||||
|
35
0012-Fix-maybe-uninitialized-warning.patch
Normal file
35
0012-Fix-maybe-uninitialized-warning.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From ee9f80190d4c458a09309fbd9a88d2756dc2d3fa Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 20:13:13 +0100
|
||||
Subject: [PATCH] Fix maybe-uninitialized warning
|
||||
|
||||
GCC gives the following compile warning:
|
||||
|
||||
grubby.c: In function 'suseGrubConfGetBoot':
|
||||
grubby.c:2770:5: error: 'grubDevice' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|
||||
2770 | free(grubDevice);
|
||||
| ^~~~~~~~~~~~~~~~
|
||||
cc1: all warnings being treated as errors
|
||||
make: *** [Makefile:38: grubby.o] Error 1
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grubby.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grubby.c b/grubby.c
|
||||
index 0c0f67a0ae5..779c25a2bf9 100644
|
||||
--- a/grubby.c
|
||||
+++ b/grubby.c
|
||||
@@ -2755,7 +2755,7 @@ int grubGetBootFromDeviceMap(const char * device,
|
||||
}
|
||||
|
||||
int suseGrubConfGetBoot(const char * path, char ** bootPtr) {
|
||||
- char * grubDevice;
|
||||
+ char * grubDevice = NULL;
|
||||
|
||||
if (suseGrubConfGetInstallDevice(path, &grubDevice))
|
||||
dbgPrintf("error looking for grub installation device\n");
|
||||
--
|
||||
2.24.1
|
||||
|
33
95-kernel-hooks.install
Executable file
33
95-kernel-hooks.install
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
|
||||
# If $BOOT_DIR_ABS exists, some other boot loader is active.
|
||||
[[ -d "$BOOT_DIR_ABS" ]] && exit 0
|
||||
|
||||
run_hooks()
|
||||
{
|
||||
local f
|
||||
local files="$1"
|
||||
for f in $files ; do
|
||||
[ -x "$f" ] || continue
|
||||
"$f" "$KERNEL_VERSION" "/boot/vmlinuz-$KERNEL_VERSION"
|
||||
done
|
||||
}
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
run_hooks "/etc/kernel/postinst.d/*[^~] /etc/kernel/postinst.d/$KERNEL_VERSION/*[^~]"
|
||||
;;
|
||||
remove)
|
||||
run_hooks "/etc/kernel/prerm.d/*[^~] /etc/kernel/prerm.d/$KERNEL_VERSION/*[^~]"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
99
grubby-bls
99
grubby-bls
@ -92,7 +92,7 @@ get_bls_values() {
|
||||
bls="${bls%.conf}"
|
||||
bls="${bls##*/}"
|
||||
echo "${bls}"
|
||||
done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp | tac)) || :
|
||||
done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp 2>/dev/null | tac)) || :
|
||||
|
||||
for bls in "${files[@]}" ; do
|
||||
blspath="${blsdir}/${bls}.conf"
|
||||
@ -197,7 +197,7 @@ param_to_indexes() {
|
||||
}
|
||||
|
||||
get_prefix() {
|
||||
if [[ $bootloader = grub2 ]] && grep -q /boot /proc/mounts; then
|
||||
if [[ $bootloader = grub2 ]] && mountpoint -q /boot; then
|
||||
echo "/boot"
|
||||
else
|
||||
echo ""
|
||||
@ -218,8 +218,20 @@ expand_var() {
|
||||
echo $var
|
||||
}
|
||||
|
||||
has_kernelopts()
|
||||
{
|
||||
local args=${bls_options[$1]}
|
||||
local opts=(${args})
|
||||
|
||||
for opt in ${opts[*]}; do
|
||||
[[ $opt = "\$kernelopts" ]] && echo "true"
|
||||
done
|
||||
|
||||
echo "false"
|
||||
}
|
||||
|
||||
get_bls_args() {
|
||||
local args=${bls_options[$i]}
|
||||
local args=${bls_options[$1]}
|
||||
local opts=(${args})
|
||||
|
||||
for opt in ${opts[*]}; do
|
||||
@ -447,8 +459,8 @@ update_args() {
|
||||
local add_args=($1) && shift
|
||||
|
||||
for arg in ${remove_args[*]}; do
|
||||
arg="$(echo $arg | sed -e 's/\//\\\//g')"
|
||||
if [[ $arg = *"="* ]]; then
|
||||
arg=$(echo $arg | sed -e 's/\//\\\//g')
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")"
|
||||
else
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||
@ -456,7 +468,8 @@ update_args() {
|
||||
done
|
||||
|
||||
for arg in ${add_args[*]}; do
|
||||
arg=${arg%=*}
|
||||
arg="${arg%%=*}"
|
||||
arg="$(echo $arg | sed -e 's/\//\\\//g')"
|
||||
args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")"
|
||||
done
|
||||
|
||||
@ -473,16 +486,41 @@ update_bls_fragment() {
|
||||
local remove_args=$1 && shift
|
||||
local add_args=$1 && shift
|
||||
local initrd=$1 && shift
|
||||
local opts
|
||||
|
||||
if [[ $indexes = "-1" ]]; then
|
||||
print_error "The param $(get_prefix)${param} is incorrect"
|
||||
fi
|
||||
|
||||
if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then
|
||||
local old_args=""
|
||||
|
||||
if [[ -z $no_etc_update ]] && [[ -e ${grub_etc_default} ]]; then
|
||||
old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})"
|
||||
if [[ -n $old_args ]]; then
|
||||
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
opts="$(echo "$opts" | sed -e 's/\//\\\//g')"
|
||||
sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
|
||||
fi
|
||||
fi
|
||||
|
||||
old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||
if [[ -n $old_args ]]; then
|
||||
opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
grub2-editenv "${env}" set kernelopts="${opts}"
|
||||
fi
|
||||
elif [[ $bootloader = grub2 ]]; then
|
||||
opts="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")"
|
||||
fi
|
||||
|
||||
for i in ${indexes[*]}; do
|
||||
if [[ -n $remove_args || -n $add_args ]]; then
|
||||
local old_args="$(get_bls_args "$i")"
|
||||
local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
|
||||
set_bls_value "${bls_file[$i]}" "options" "${new_args}"
|
||||
|
||||
if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then
|
||||
set_bls_value "${bls_file[$i]}" "options" "${new_args}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n $initrd ]]; then
|
||||
@ -516,31 +554,35 @@ set_default_bls() {
|
||||
}
|
||||
|
||||
remove_var_prefix() {
|
||||
local prefix="$1"
|
||||
|
||||
[ -z "${prefix}" ] && return
|
||||
|
||||
if [[ -n $remove_kernel && $remove_kernel =~ ^/ ]]; then
|
||||
remove_kernel="/${remove_kernel##*/}"
|
||||
remove_kernel="/${remove_kernel##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $initrd ]]; then
|
||||
initrd="/${initrd##*/}"
|
||||
initrd="/${initrd##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $extra_initrd ]]; then
|
||||
extra_initrd=" /${extra_initrd##*/}"
|
||||
extra_initrd=" /${extra_initrd##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $kernel ]]; then
|
||||
kernel="/${kernel##*/}"
|
||||
kernel="/${kernel##${prefix}/}"
|
||||
fi
|
||||
|
||||
if [[ -n $update_kernel && $update_kernel =~ ^/ ]]; then
|
||||
update_kernel="/${update_kernel##*/}"
|
||||
update_kernel="/${update_kernel##${prefix}/}"
|
||||
fi
|
||||
}
|
||||
|
||||
update_grubcfg()
|
||||
{
|
||||
if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then
|
||||
grub2-mkconfig -o /boot/grub2/grub.cfg >& /dev/null
|
||||
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -563,7 +605,6 @@ Usage: grubby [OPTION...]
|
||||
--initrd=initrd-path initrd image for the new kernel
|
||||
-i, --extra-initrd=initrd-path auxiliary initrd image for things other than the new kernel
|
||||
--make-default make the newly added entry the default boot entry
|
||||
-o, --output-file=path path to output updated config file ("-" for stdout)
|
||||
--remove-args=STRING remove kernel arguments
|
||||
--remove-kernel=kernel-path remove all entries for the specified kernel
|
||||
--set-default=kernel-path make the first entry referencing the specified kernel the default
|
||||
@ -572,6 +613,7 @@ Usage: grubby [OPTION...]
|
||||
--update-kernel=kernel-path updated information for the specified kernel
|
||||
--zipl configure zipl bootloader
|
||||
-b, --bls-directory path to directory containing the BootLoaderSpec fragment files
|
||||
--no-etc-grub-update don't update the GRUB_CMDLINE_LINUX variable in /etc/default/grub
|
||||
|
||||
Help options:
|
||||
-?, --help Show this help message
|
||||
@ -579,11 +621,11 @@ Help options:
|
||||
EOF
|
||||
}
|
||||
|
||||
OPTS="$(getopt -o c:i:o:b:? --long help,add-kernel:,args:,bad-image-okay,\
|
||||
OPTS="$(getopt -o c:i:b:? --long help,add-kernel:,args:,bad-image-okay,\
|
||||
config-file:,copy-default,default-kernel,default-index,default-title,env:,\
|
||||
grub2,info:,initrd:,extra-initrd:,make-default,output-file:,remove-args:,\
|
||||
grub2,info:,initrd:,extra-initrd:,make-default,remove-args:,\
|
||||
remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\
|
||||
bls-directory:,add-kernel:,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\
|
||||
bls-directory:,no-etc-grub-update,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\
|
||||
bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\
|
||||
output-file:,remove-mbargs:,remove-multiboot:,silo,yaboot -n ${SCRIPTNAME} -- "$@")"
|
||||
|
||||
@ -609,6 +651,7 @@ while [ ${#} -gt 0 ]; do
|
||||
bad_image=true
|
||||
;;
|
||||
--config-file|-c)
|
||||
grub_config="${2}"
|
||||
zipl_config="${2}"
|
||||
shift
|
||||
;;
|
||||
@ -646,10 +689,6 @@ while [ ${#} -gt 0 ]; do
|
||||
--make-default)
|
||||
make_default=true
|
||||
;;
|
||||
--output-file|-o)
|
||||
output_file="${2}"
|
||||
shift
|
||||
;;
|
||||
--remove-args)
|
||||
remove_args="${2}"
|
||||
shift
|
||||
@ -681,7 +720,11 @@ while [ ${#} -gt 0 ]; do
|
||||
blsdir="${2}"
|
||||
shift
|
||||
;;
|
||||
--add-kernel|--add-multiboot|--mbargs|--mounts|--boot-filesystem|\
|
||||
--no-etc-grub-update)
|
||||
no_etc_update=true
|
||||
shift
|
||||
;;
|
||||
--add-multiboot|--mbargs|--mounts|--boot-filesystem|\
|
||||
--bootloader-probe|--debug|--devtree|--devtreedir|--elilo|--efi|\
|
||||
--extlinux|--grub|--lilo|--output-file|--remove-mbargs|--silo|\
|
||||
--remove-multiboot|--slilo|--yaboot)
|
||||
@ -706,7 +749,7 @@ while [ ${#} -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z $update_kernel ]] && [[ -n $args || -n $remove_args ]]; then
|
||||
if [[ -z $update_kernel && -z $kernel ]] && [[ -n $args || -n $remove_args ]]; then
|
||||
print_error "no action specified"
|
||||
fi
|
||||
|
||||
@ -722,6 +765,14 @@ if [[ -z $zipl_config ]]; then
|
||||
zipl_config="/etc/zipl.conf"
|
||||
fi
|
||||
|
||||
if [[ -z $grub_config ]]; then
|
||||
grub_config="/boot/grub2/grub.cfg"
|
||||
fi
|
||||
|
||||
if [[ -z $grub_etc_default ]]; then
|
||||
grub_etc_default="/etc/default/grub"
|
||||
fi
|
||||
|
||||
get_bls_values
|
||||
|
||||
default_index="$(get_default_index)"
|
||||
@ -734,9 +785,7 @@ if [[ -n $display_info ]]; then
|
||||
display_info_values "${display_info}"
|
||||
fi
|
||||
|
||||
if [[ $(get_prefix) == "/boot" ]]; then
|
||||
remove_var_prefix
|
||||
fi
|
||||
remove_var_prefix "$(get_prefix)"
|
||||
|
||||
if [[ -n $kernel ]]; then
|
||||
if [[ $copy_default = "true" ]]; then
|
||||
|
179
grubby.8
Normal file
179
grubby.8
Normal file
@ -0,0 +1,179 @@
|
||||
.TH GRUBBY 8 "Wed Apr 29 2020"
|
||||
.SH NAME
|
||||
grubby \- command line tool for configuring grub and zipl
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBgrubby\fR [--add-kernel=\fIkernel-path\fR] [--args=\fIargs\fR]
|
||||
[--bad-image-okay] [--config-file=\fIpath\fR] [--copy-default]
|
||||
[--default-kernel] [--default-index] [--default-title]
|
||||
[--env=\fIpath\fR] [--grub2] [--info=\fIkernel-path\fR]
|
||||
[--initrd=\fIinitrd-path\fR] [--extra-initrd=\fIinitrd-path\fR]
|
||||
[--make-default] [--remove-args=\fIargs\fR]
|
||||
[--remove-kernel=\fIkernel-path\fR] [--set-default=\fIkernel-path\fR]
|
||||
[--set-default-index=\fientry-index\fR] [--title=\fentry-title\fR]
|
||||
[--update-kernel=\fIkernel-path\fR] [--zipl] [--bls-directory=\fIpath\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBgrubby\fR is a command line tool for updating and displaying information
|
||||
about the configuration files for the \fBgrub2\fR and \fBzipl\fR boot loaders.
|
||||
It is primarily designed to be used from scripts which install new kernels and
|
||||
need to find information about the current boot environment.
|
||||
|
||||
On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and
|
||||
the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel
|
||||
x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration
|
||||
file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On PowerPC platforms, systems
|
||||
based on Power8 and Power9 support \fBgrub2\fR as a bootloader and use a
|
||||
configuration stored in \fB/boot/grub2/grub.cfg\fR. On s390x platforms the
|
||||
\fBzipl\fR bootloader use a default configuration in \fB/etc/zipl.conf\fR.
|
||||
|
||||
All bootloaders define the boot entries as individual configuration fragments
|
||||
that are stored by default in \fB/boot/loader/entries\fR. The format for the
|
||||
config files is specified at \fBhttps://systemd.io/BOOT_LOADER_SPECIFICATION\fR.
|
||||
The \fBgrubby\fR tool is used to update and display the configuration defined
|
||||
in the BootLoaderSpec fragment files.
|
||||
|
||||
There are a number of ways to specify the kernel used for \fB-\-info\fR,
|
||||
\fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR
|
||||
or \fBALL\fR selects the default entry and all of the entries, respectively.
|
||||
Also, the title of a boot entry may be specified by using \fBTITLE=\fItitle\fR
|
||||
as the argument; all entries with that title are used.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB-\-add-kernel\fR=\fIkernel-path\fR
|
||||
Add a new boot entry for the kernel located at \fIkernel-path\fR.
|
||||
|
||||
.TP
|
||||
\fB-\-args\fR=\fIkernel-args\fR
|
||||
When a new kernel is added, this specifies the command line arguments
|
||||
which should be passed to the kernel by default (note they are merged
|
||||
with the arguments of the default entry if \fB-\-copy-default\fR is used).
|
||||
When \fB-\-update-kernel\fR is used, this specifies new arguments to add
|
||||
to the argument list. Multiple, space separated arguments may be used. If
|
||||
an argument already exists the new value replaces the old values. The
|
||||
\fBroot=\fR kernel argument gets special handling if the configuration
|
||||
file has special handling for specifying the root filesystem.
|
||||
|
||||
.TP
|
||||
\fB-\-bad-image-okay\fR
|
||||
When \fBgrubby\fR is looking for an entry to use for something (such
|
||||
as a default boot entry) it uses sanity checks, such as ensuring that
|
||||
the kernel exists in the filesystem, to make sure entries that obviously
|
||||
won't work aren't selected. This option overrides that behavior, and is
|
||||
designed primarily for testing.
|
||||
|
||||
.TP
|
||||
\fB-\-config-file\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the configuration file rather then the default.
|
||||
|
||||
.TP
|
||||
\fB-\-copy-default\fR
|
||||
\fBgrubby\fR will copy as much information (such as kernel arguments and
|
||||
root device) as possible from the current default kernel. The kernel path
|
||||
and initrd path will never be copied.
|
||||
|
||||
.TP
|
||||
\fB-\-default-kernel\fR
|
||||
Display the full path to the current default kernel and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-default-index\fR
|
||||
Display the numeric index of the current default boot entry and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-default-title\fR
|
||||
Display the title of the current default boot entry and exit.
|
||||
|
||||
.TP
|
||||
\fB-\-env\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the grub2 environment block file rather then the default path.
|
||||
|
||||
.TP
|
||||
\fB-\-grub2\fR
|
||||
Configure \fBgrub2\fR bootloader.
|
||||
|
||||
.TP
|
||||
\fB-\-info\fR=\fIkernel-path\fR
|
||||
Display information on all boot entries which match \fIkernel-path\fR. If
|
||||
\fIkernel-path\fR is \fBDEFAULT\fR, then information on the default kernel
|
||||
is displayed. If \fIkernel-path\fR is \fBALL\fR, then information on all boot
|
||||
entries are displayed.
|
||||
|
||||
.TP
|
||||
\fB-\-initrd\fR=\fIinitrd-path\fR
|
||||
Use \fIinitrd-path\fR as the path to an initial ram disk for a new kernel
|
||||
being added.
|
||||
|
||||
.TP
|
||||
\fB-\-extrainitrd\fR=\fIinitrd-path\fR
|
||||
Use \fIinitrd-path\fR as the path to an auxiliary init ram disk image to be
|
||||
added to the boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-make-default\fR
|
||||
Make the new kernel entry being added the default entry.
|
||||
|
||||
.TP
|
||||
\fB-\-remove-args\fR=\fIkernel-args\fR
|
||||
The arguments specified by \fIkernel-args\fR are removed from the kernels
|
||||
specified by \fB-\-update-kernel\fR. The \fBroot\fR argument gets special
|
||||
handling for configuration files that support separate root filesystem
|
||||
configuration.
|
||||
|
||||
.TP
|
||||
\fB-\-remove-kernel\fR=\fIkernel-path\fR
|
||||
Removes all boot entries which match \fIkernel-path\fR. This may be used
|
||||
along with -\-add-kernel, in which case the new kernel being added will
|
||||
never be removed.
|
||||
|
||||
.TP
|
||||
\fB-\-set-default\fR=\fIkernel-path\fR
|
||||
The first entry which boots the specified kernel is made the default
|
||||
boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-set-default-index\fR=\fIentry-index\fR
|
||||
Makes the given entry number the default boot entry.
|
||||
|
||||
.TP
|
||||
\fB-\-title\fR=\fIentry-title\fR
|
||||
When a new kernel entry is added \fIentry-title\fR is used as the title
|
||||
for the entry.
|
||||
|
||||
.TP
|
||||
\fB-\-update-kernel\fR=\fIkernel-path\fR
|
||||
The entries for kernels matching \fRkernel-path\fR are updated. Currently
|
||||
the only items that can be updated is the kernel argument list, which is
|
||||
modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. If the
|
||||
\fBALL\fR argument is used the variable \fB GRUB_CMDLINE_LINUX\fR in
|
||||
\fB/etc/default/grub\fR is updated with the latest kernel argument list,
|
||||
unless the \fB-\-no-etc-grub-update\fR option is used.
|
||||
|
||||
.TP
|
||||
\fB-\-zipl\fR
|
||||
Configure \fBzipl\fR bootloader.
|
||||
|
||||
.TP
|
||||
\fB-\-bls-directory\fR=\fIpath\fR
|
||||
Use \fIpath\fR as the directory for the BootLoaderSpec config files rather
|
||||
than the default \fB/boot/loader/entries\fR.
|
||||
|
||||
.TP
|
||||
\fB-\-no-etc-grub-update\fR
|
||||
Makes grubby to not update the \fBGRUB_CMDLINE_LINUX\fR variable in
|
||||
\fB/etc/default/grub\fR when the \fB-\-update-kernel\fR option is
|
||||
used with the \fBALL\fR argument.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR zipl (8),
|
||||
.BR mkinitrd (8),
|
||||
.BR kernel-install (8)
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Erik Troan
|
||||
Jeremy Katz
|
||||
Peter Jones
|
||||
Javier Martinez
|
||||
.fi
|
96
grubby.spec
96
grubby.spec
@ -1,6 +1,6 @@
|
||||
Name: grubby
|
||||
Version: 8.40
|
||||
Release: 27%{?dist}
|
||||
Release: 45%{?dist}
|
||||
Summary: Command line tool for updating bootloader configs
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rhinstaller/grubby
|
||||
@ -13,6 +13,8 @@ Source1: grubby-bls
|
||||
Source2: grubby.in
|
||||
Source3: installkernel.in
|
||||
Source4: installkernel-bls
|
||||
Source5: 95-kernel-hooks.install
|
||||
Source6: grubby.8
|
||||
Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch
|
||||
Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch
|
||||
Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch
|
||||
@ -23,6 +25,8 @@ Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch
|
||||
Patch0008: 0008-Add-usr-libexec-rpm-sort.patch
|
||||
Patch0009: 0009-Improve-man-page-for-info-option.patch
|
||||
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
|
||||
Patch0011: 0011-Fix-stringop-overflow-warning.patch
|
||||
Patch0012: 0012-Fix-maybe-uninitialized-warning.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: pkgconfig glib2-devel popt-devel
|
||||
@ -39,8 +43,9 @@ Requires: grub2-tools
|
||||
Requires: s390utils-base
|
||||
%endif
|
||||
Requires: findutils
|
||||
Requires: util-linux
|
||||
|
||||
Obsoletes: %{name}-bls
|
||||
Obsoletes: %{name}-bls < %{version}-%{release}
|
||||
|
||||
%description
|
||||
This package provides a grubby compatibility script that manages
|
||||
@ -74,23 +79,21 @@ make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir} libex
|
||||
mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbindir}/
|
||||
mv -v %{buildroot}%{_sbindir}/grubby %{buildroot}%{_libexecdir}/grubby/grubby
|
||||
mv -v %{buildroot}%{_sbindir}/installkernel %{buildroot}%{_libexecdir}/installkernel/installkernel
|
||||
cp -v %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/
|
||||
cp -v %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/
|
||||
install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/
|
||||
install -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/
|
||||
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
|
||||
> %{buildroot}%{_sbindir}/grubby
|
||||
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
|
||||
> %{buildroot}%{_sbindir}/installkernel
|
||||
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5}
|
||||
rm %{buildroot}%{_mandir}/man8/grubby.8*
|
||||
install -m 0644 %{SOURCE6} %{buildroot}%{_mandir}/man8/
|
||||
|
||||
%post
|
||||
if [ "$1" = 2 ]; then
|
||||
arch=$(uname -m)
|
||||
if [[ $arch == "s390x" ]]; then
|
||||
command=zipl-switch-to-blscfg
|
||||
else
|
||||
command=grub2-switch-to-blscfg
|
||||
fi
|
||||
|
||||
$command --backup-suffix=.rpmsave &>/dev/null || :
|
||||
[[ $arch == "s390x" ]] && \
|
||||
zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
|
||||
fi
|
||||
|
||||
%package deprecated
|
||||
@ -117,6 +120,7 @@ current boot environment.
|
||||
%attr(0755,root,root) %{_sbindir}/grubby
|
||||
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel-bls
|
||||
%attr(0755,root,root) %{_sbindir}/installkernel
|
||||
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
|
||||
%{_mandir}/man8/[gi]*.8*
|
||||
|
||||
%files deprecated
|
||||
@ -132,6 +136,76 @@ current boot environment.
|
||||
%{_mandir}/man8/*.8*
|
||||
|
||||
%changelog
|
||||
* Wed May 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-45
|
||||
- grubby-bls: don't replace options with kernelopts if values are the same
|
||||
|
||||
* Wed May 06 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-44
|
||||
- Fix installed man page file mode bits
|
||||
|
||||
* Tue May 05 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-43
|
||||
- grubby-bls: always escape the delimiter character used in sed commands
|
||||
- grubby-bls: add a --no-etc-grub-update option
|
||||
|
||||
* Wed Apr 29 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-42
|
||||
- grubby-bls: fix corner case when a kernel param value contains a '='
|
||||
- grubby-bls: update man page to match options in current wrapper script
|
||||
|
||||
* Mon Mar 30 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-41
|
||||
- Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub
|
||||
Related: rhbz#1287854
|
||||
|
||||
* Mon Feb 10 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-40
|
||||
- Fix FTBFS
|
||||
Resolves: rhbz#1799496
|
||||
- Fix wrong S-o-B tag in patch
|
||||
- Fix warning about using unversioned Obsoletes
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-39
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Nov 29 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-38
|
||||
- grubby-bls: don't update grubenv when generating grub.cfg for ppc64le
|
||||
Related: rhbz#1726514
|
||||
|
||||
* Thu Nov 28 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-37
|
||||
- grubby-bls: don't print rpm-sort error messages
|
||||
Resolves: rhbz#1731924
|
||||
- grubby-bls: remove -o option and support -c for ppc64le grub config
|
||||
Resolves: rhbz#1758598
|
||||
- grubby-bls: fix logic to check if the kernelopts var is defined in a BLS
|
||||
Resolves: rhbz#1726514
|
||||
|
||||
* Tue Aug 06 2019 Yuval Turgeman <yturgema@redhat.com> - 8.40-36
|
||||
- grubby-bls: strip only /boot from paths
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-35
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Mon Jun 17 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-34
|
||||
- Add a kernel-install plugin to execute hook scripts in /etc/kernel/
|
||||
Resolves: rhbz#1696202
|
||||
|
||||
* Mon Jun 10 22:13:19 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.40-33
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Mon Jun 10 15:42:02 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.40-32
|
||||
- Rebuild for RPM 4.15
|
||||
|
||||
* Fri May 03 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-31
|
||||
- Use mountpoint command to check whether /boot is a mount point
|
||||
Resolves: rhbz#1706091
|
||||
|
||||
* Thu Mar 21 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-30
|
||||
- grubby-bls: fix --add-kernel not working when using the --args option
|
||||
Resolves: rhbz#1691004
|
||||
|
||||
* Mon Mar 11 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-29
|
||||
- Only switch to BLS config for s390x / zipl
|
||||
Related: rhbz#1652806
|
||||
|
||||
* Fri Mar 01 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-28
|
||||
- grubby-bls: make --update-kernel ALL to update kernelopts var in grubenv
|
||||
|
||||
* Thu Feb 14 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-27
|
||||
- grubby-bls: error if args or remove-args is used without update-kernel
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user