summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-25 10:11:09 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-25 10:11:09 +0300
commitb42511b6cf58a20305ccc2faf361126983126c47 (patch)
tree314e04a3cd62ed1db88bcde4a98694b69a75d3f8
parentade2b23672b5651f978d3f13348d3894bba6cc9a (diff)
downloadvmdb2-b42511b6cf58a20305ccc2faf361126983126c47.tar.gz
feat(grub): add timeout setting
-rw-r--r--NEWS4
-rw-r--r--vmdb/plugins/grub.mdwn3
-rw-r--r--vmdb/plugins/grub_plugin.py7
3 files changed, 14 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index c31a725..2b620d7 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ Version 0.15+git, not yet released
* Add a `quiet` field to the grub step to configure the kernel boot to
be quiet or not. Default is now not quiet, which is a change from before.
+* Add a `timeout` field to the grub step to configure grub menu
+ timeout. Default is now zero seconds, which is a change from the
+ Debian default of five seconds.
+
Version 0.15, released 2020-05-05
------------------------------------
diff --git a/vmdb/plugins/grub.mdwn b/vmdb/plugins/grub.mdwn
index c2abe54..645caf0 100644
--- a/vmdb/plugins/grub.mdwn
+++ b/vmdb/plugins/grub.mdwn
@@ -27,6 +27,9 @@ Step keys:
* `quiet` &mdash; OPTIONAL; should the kernel be configured to boot
quietly? Default is no.
+* `timeout` &mdash; OPTIONAL; set the grub menu timeout, in seconds.
+ Defaults to 0 seconds.
+
Example (in the .vmdb file):
- grub: bios
diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py
index e9501e4..29af435 100644
--- a/vmdb/plugins/grub_plugin.py
+++ b/vmdb/plugins/grub_plugin.py
@@ -95,6 +95,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
"tag": "",
"image-dev": "",
"quiet": False,
+ "timeout": 0,
}
def run(self, values, settings, state):
@@ -174,6 +175,7 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
self.set_grub_cmdline_config(chroot, kernel_params)
self.add_grub_crypto_disk(chroot)
+ self.set_grub_timeout(chroot, values["timeout"])
if console == "serial":
self.add_grub_serial_console(chroot)
@@ -277,3 +279,8 @@ class GrubStepRunner(vmdb.StepRunnerInterface):
filename = self.chroot_path(chroot, "/etc/default/grub")
with open(filename, "a") as f:
f.write("GRUB_ENABLE_CRYPTODISK=y\n")
+
+ def set_grub_timeout(self, chroot, timeout):
+ filename = self.chroot_path(chroot, "/etc/default/grub")
+ with open(filename, "a") as f:
+ f.write("GRUB_TIMEOUT={}\n".format(timeout))