grubby-bls: print the absolute kernel and initramfs images paths
The BLS file "linux" and "initrd" fields expect a relative paths from the root of the partition that contains the kernel and initramfs. The grubby tool was printing the value of thse fields and not their full path. So if there is a partition and /boot is a mount point, he BLS would have: linux /vmlinuz-4.18.0-38.el8.x86_64 initrd /initramfs-4.18.0-38.el8.x86_64.img And grubby would print: kernel="/vmlinuz-4.18.0-38.el8.x86_64" initrd="/initramfs-4.18.0-38.el8.x86_64.img" But the old tool used to print the full paths of the images, so should be: kernel="/boot/vmlinuz-4.18.0-38.el8.x86_64" initrd="/boot/initramfs-4.18.0-38.el8.x86_64.img" Resolves: rhbz#1649778 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
791d55400b
commit
6cdfe45ece
24
grubby-bls
24
grubby-bls
@ -206,8 +206,17 @@ param_to_indexes() {
|
|||||||
echo -n "-1"
|
echo -n "-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_prefix() {
|
||||||
|
if [[ $bootloader = grub2 ]] && grep -q /boot /proc/mounts; then
|
||||||
|
echo "/boot"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
display_info_values() {
|
display_info_values() {
|
||||||
local indexes=($(param_to_indexes "$1"))
|
local indexes=($(param_to_indexes "$1"))
|
||||||
|
local prefix=$(get_prefix)
|
||||||
|
|
||||||
if [[ $indexes = "-1" ]]; then
|
if [[ $indexes = "-1" ]]; then
|
||||||
print_error "The param $1 is incorrect"
|
print_error "The param $1 is incorrect"
|
||||||
@ -215,9 +224,9 @@ display_info_values() {
|
|||||||
|
|
||||||
for i in ${indexes[*]}; do
|
for i in ${indexes[*]}; do
|
||||||
echo "index=$i"
|
echo "index=$i"
|
||||||
echo "kernel=\"${bls_linux[$i]}\""
|
echo "kernel=\"${prefix}${bls_linux[$i]}\""
|
||||||
echo "args=\"${bls_options[$i]}\""
|
echo "args=\"${bls_options[$i]}\""
|
||||||
echo "initrd=\"${bls_initrd[$i]}\""
|
echo "initrd=\"${prefix}${bls_initrd[$i]}\""
|
||||||
echo "title=\"${bls_title[$i]}\""
|
echo "title=\"${bls_title[$i]}\""
|
||||||
echo "id=\"${bls_id[$i]}\""
|
echo "id=\"${bls_id[$i]}\""
|
||||||
done
|
done
|
||||||
@ -231,6 +240,11 @@ mkbls() {
|
|||||||
|
|
||||||
local debugname=""
|
local debugname=""
|
||||||
local flavor=""
|
local flavor=""
|
||||||
|
local prefix=""
|
||||||
|
|
||||||
|
if [[ $(get_prefix) = "" ]]; then
|
||||||
|
prefix="/boot"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $kernelver == *\+* ]] ; then
|
if [[ $kernelver == *\+* ]] ; then
|
||||||
local flavor=-"${kernelver##*+}"
|
local flavor=-"${kernelver##*+}"
|
||||||
@ -244,7 +258,7 @@ mkbls() {
|
|||||||
title ${NAME} (${kernelver}) ${VERSION}${debugname}
|
title ${NAME} (${kernelver}) ${VERSION}${debugname}
|
||||||
version ${kernelver}${debugid}
|
version ${kernelver}${debugid}
|
||||||
linux ${kernel}
|
linux ${kernel}
|
||||||
initrd /initramfs-${kernelver}.img
|
initrd ${prefix}/initramfs-${kernelver}.img
|
||||||
options \$kernelopts
|
options \$kernelopts
|
||||||
id ${ID}-${datetime}-${kernelver}${debugid}
|
id ${ID}-${datetime}-${kernelver}${debugid}
|
||||||
grub_users \$grub_users
|
grub_users \$grub_users
|
||||||
@ -468,7 +482,7 @@ set_default_bls() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_info "The default is ${bls_file[$index]} with index $index and kernel ${bls_linux[$index]}"
|
print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_var_prefix() {
|
remove_var_prefix() {
|
||||||
@ -686,7 +700,7 @@ if [[ -n $display_info ]]; then
|
|||||||
display_info_values "${display_info}"
|
display_info_values "${display_info}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $bootloader = grub2 ]] && grep -q /boot /proc/mounts; then
|
if [[ $(get_prefix) == "/boot" ]]; then
|
||||||
remove_var_prefix
|
remove_var_prefix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user