Fix GRUB_TIMEOUT usage and remove GRUB_HIDDEN_TIMEOUT
This commit removes the GRUB_HIDDEN_TIMEOUT options which shouldn't be used together with GRUB_TIMEOUT set to a non-zero value. Also, it fixes the bug and from now the Grub menu will always be shown. Change-Id: I547ef994c6d239289d12fbdfede0416e766f2710 Closes-Bug: #1540638
This commit is contained in:
parent
20d2288eee
commit
77c48d3eba
|
@ -13,6 +13,7 @@ dist
|
|||
|
||||
*.egg
|
||||
.testrepository
|
||||
.cache
|
||||
.tox
|
||||
.idea
|
||||
.DS_Store
|
||||
|
|
|
@ -456,9 +456,13 @@ title Default (kernel-version-set)
|
|||
mock_mkconfig.return_value = '/sbin/grub-mkconfig'
|
||||
mock_conf.return_value = '/boot/grub/grub.cfg'
|
||||
orig_content = """foo
|
||||
GRUB_HIDDEN_TIMEOUT=5
|
||||
GRUB_HIDDEN_TIMEOUT_QUIET=true
|
||||
GRUB_TIMEOUT=5
|
||||
GRUB_CMDLINE_LINUX="kernel-params-orig"
|
||||
bar"""
|
||||
new_content = """foo
|
||||
GRUB_TIMEOUT=10
|
||||
GRUB_CMDLINE_LINUX="kernel-params-new"
|
||||
bar
|
||||
GRUB_RECORDFAIL_TIMEOUT=10
|
||||
|
|
|
@ -230,16 +230,18 @@ def grub2_install(install_devices, chroot=''):
|
|||
def grub2_cfg(kernel_params='', chroot='', grub_timeout=10):
|
||||
grub_defaults = chroot + guess_grub2_default(chroot=chroot)
|
||||
rekerparams = re.compile(r'^.*GRUB_CMDLINE_LINUX=.*')
|
||||
retimeout = re.compile(r'^.*GRUB_HIDDEN_TIMEOUT=.*')
|
||||
retimeout = re.compile(r'^.*GRUB_TIMEOUT=.*')
|
||||
rehidtimeout = re.compile(r'^.*GRUB_HIDDEN_TIMEOUT.*')
|
||||
new_content = ''
|
||||
with open(grub_defaults) as f:
|
||||
for line in f:
|
||||
line = rekerparams.sub(
|
||||
'GRUB_CMDLINE_LINUX="{kernel_params}"'.
|
||||
format(kernel_params=kernel_params), line)
|
||||
line = retimeout.sub('GRUB_HIDDEN_TIMEOUT={grub_timeout}'.
|
||||
line = retimeout.sub('GRUB_TIMEOUT={grub_timeout}'.
|
||||
format(grub_timeout=grub_timeout), line)
|
||||
new_content += line
|
||||
if not rehidtimeout.search(line):
|
||||
new_content += line
|
||||
# NOTE(agordeev): explicitly add record fail timeout, in order to
|
||||
# prevent user confirmation appearing if unexpected reboot occured.
|
||||
new_content += '\nGRUB_RECORDFAIL_TIMEOUT={grub_timeout}\n'.\
|
||||
|
|
Loading…
Reference in New Issue