Fix update-iso.sh handling of existing timeout in grub.cfg
Fix a bug where the submenu timeout is corrupted by an incorrect sed command. In addition, update handling of 0 second timeout to set the timeout in grub.cfg to 0.001, to avoid issues on some systems with timeout=0. Change-Id: I0683f39eb906da512cacc77bde28f8420a73a001 Closes-Bug: 1856764 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
1903bbab7f
commit
f7886f9950
|
@ -299,10 +299,12 @@ function set_timeout {
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in ${isodir}/EFI/BOOT/grub.cfg ${EFI_MOUNT}/EFI/BOOT/grub.cfg; do
|
for f in ${isodir}/EFI/BOOT/grub.cfg ${EFI_MOUNT}/EFI/BOOT/grub.cfg; do
|
||||||
|
sed -i "s/^timeout=.*/timeout=${GRUB_TIMEOUT}/" ${f}
|
||||||
|
|
||||||
grep -q "^ set timeout=" ${f}
|
grep -q "^ set timeout=" ${f}
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# Submenu timeout is already added. Update the value
|
# Submenu timeout is already added. Update the value
|
||||||
sed -i -e "s#^ set timeout=.*#${GRUB_TIMEOUT}#" ${f}
|
sed -i -e "s#^ set timeout=.*# set timeout=${GRUB_TIMEOUT}#" ${f}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to update grub timeout"
|
echo "Failed to update grub timeout"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -327,7 +329,7 @@ declare DEFAULT_LABEL=
|
||||||
declare DEFAULT_GRUB_ENTRY=
|
declare DEFAULT_GRUB_ENTRY=
|
||||||
declare UPDATE_TIMEOUT="no"
|
declare UPDATE_TIMEOUT="no"
|
||||||
declare -i TIMEOUT=0
|
declare -i TIMEOUT=0
|
||||||
declare -i GRUB_TIMEOUT=-1
|
declare GRUB_TIMEOUT=-1
|
||||||
declare EFI_MOUNT=
|
declare EFI_MOUNT=
|
||||||
declare EFIBOOT_IMG_LOOP=
|
declare EFIBOOT_IMG_LOOP=
|
||||||
|
|
||||||
|
@ -381,7 +383,9 @@ while getopts "hi:o:a:p:d:t:" opt; do
|
||||||
let -i timeout_arg=${OPTARG}
|
let -i timeout_arg=${OPTARG}
|
||||||
if [ ${timeout_arg} -gt 0 ]; then
|
if [ ${timeout_arg} -gt 0 ]; then
|
||||||
let -i TIMEOUT=${timeout_arg}*10
|
let -i TIMEOUT=${timeout_arg}*10
|
||||||
let -i GRUB_TIMEOUT=${timeout_arg}
|
GRUB_TIMEOUT=${timeout_arg}
|
||||||
|
elif [ ${timeout_arg} -eq 0 ]; then
|
||||||
|
GRUB_TIMEOUT=0.001
|
||||||
fi
|
fi
|
||||||
|
|
||||||
UPDATE_TIMEOUT="yes"
|
UPDATE_TIMEOUT="yes"
|
||||||
|
|
Loading…
Reference in New Issue