Skip to content

Commit e33017d

Browse files
authored
Merge pull request #83 from enkidushane/grub_timeout_style
Grub timeout style
2 parents 7d167ee + f028d44 commit e33017d

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ This module manages GRUB 2 bootloader (Hiera & EFI)
148148
- Define how long (in seconds) that the menu should appear
149149
- **INTEGER** : *5*
150150

151+
#### timeout_style
152+
- Define what to display while waiting for timeout to expire
153+
- **STRING** : *'countdown'*
154+
151155
#### tune
152156
- Define if GRUB should make a beep when he starts
153157
- **STRING** : *Empty by default*

data/common.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ grub2::disable_uuid: false
1515
grub2::enable_cryptodisk: false
1616
grub2::enable_blscfg: false
1717
grub2::hidden_timeout: ~
18-
grub2::hidden_timeout_quiet: false
18+
grub2::hidden_timeout_quiet: ~
1919
grub2::install_grub: false
2020
grub2::remove_grub_legacy: false
2121
grub2::package_ensure: present
@@ -31,5 +31,6 @@ grub2::serial_command: ''
3131
grub2::suse_btrfs_snapshot_booting: false
3232
grub2::terminal: ''
3333
grub2::timeout: 5
34+
grub2::timeout_style: 'countdown'
3435
grub2::tune: ''
3536
grub2::update_grub: true

manifests/init.pp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
# Define how long (in seconds) that the menu should appear
139139
# INTEGER : 5
140140
#
141+
# [*timeout_style*]
142+
# Define what to display while waiting for timeout to expire
143+
# STRING : 'countdown'
144+
#
141145
# [*tune*]
142146
# Define if GRUB should make a beep when he starts
143147
# STRING : Empty by default
@@ -205,7 +209,7 @@
205209
Boolean $enable_cryptodisk = $grub2::params::enable_cryptodisk,
206210
String $gfxmode = $grub2::params::gfxmode,
207211
Optional[String] $hidden_timeout = $grub2::params::hidden_timeout,
208-
Boolean $hidden_timeout_quiet = $grub2::params::hidden_timeout_quiet,
212+
Optional[Boolean] $hidden_timeout_quiet = $grub2::params::hidden_timeout_quiet,
209213
Stdlib::Absolutepath $install_binary = $grub2::params::install_binary,
210214
Boolean $install_grub = $grub2::params::install_grub,
211215
Boolean $remove_grub_legacy = $grub2::params::remove_grub_legacy,
@@ -223,10 +227,21 @@
223227
Boolean $suse_btrfs_snapshot_booting = $grub2::params::suse_btrfs_snapshot_booting,
224228
String $terminal = $grub2::params::terminal,
225229
Integer $timeout = $grub2::params::timeout,
230+
String $timeout_style = $grub2::params::timeout_style,
226231
String $tune = $grub2::params::tune,
227232
Stdlib::Absolutepath $update_binary = $grub2::params::update_binary,
228233
Boolean $update_grub = $grub2::params::update_grub,
229234
) inherits grub2::params {
235+
236+
# Warn if timeout_style and either of the hidden_timout values are set, and respect old syntax
237+
if defined('$timeout_style') and ( $hidden_timeout_quiet =~ Boolean or $hidden_timeout =~ String) ) {
238+
notify { 'Newer timeout_style and at least one of deprecated hidden_timeout(_quiet)? defined at the same time. Using deprecated syntax, but you should fix this.': }
239+
$timeout_style_disable = true
240+
} else {
241+
$timeout_style_disable = false
242+
}
243+
}
244+
230245
anchor { 'grub2::begin': }
231246
-> class { '::grub2::install': }
232247
~> class { '::grub2::config': }

manifests/params.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$enable_cryptodisk = false
1919
$gfxmode = ''
2020
$hidden_timeout = undef
21-
$hidden_timeout_quiet = false
21+
$hidden_timeout_quiet = undef
2222
$install_grub = false
2323
$remove_grub_legacy = false
2424
$package_ensure = 'present'
@@ -34,6 +34,7 @@
3434
$suse_btrfs_snapshot_booting = false
3535
$terminal = ''
3636
$timeout = 5
37+
$timeout_style = 'countdown'
3738
$tune = ''
3839
$update_grub = true
3940

templates/default_grub.erb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
# Editing is no use unless you avoid running the Puppet agent
33

44
GRUB_DEFAULT=<%= @default_entry %>
5+
<% if @timeout_style != nil and ! @timeout_style_disable -%>
6+
GRUB_TIMEOUT_STYLE="<%= @timeout_style %>"
7+
<% end -%>
58
GRUB_TIMEOUT=<%= @timeout %>
6-
<% if @hidden_timeout != nil -%>
9+
<% if @timeout_style_disable -%>
10+
<% if @hidden_timeout != nil -%>
711
GRUB_HIDDEN_TIMEOUT=<%= @hidden_timeout %>
8-
<% end -%>
9-
<% if @hidden_timeout_quiet != nil -%>
12+
<% end -%>
13+
<% if @hidden_timeout_quiet != nil -%>
1014
GRUB_HIDDEN_TIMEOUT_QUIET="<%= @hidden_timeout_quiet %>"
15+
<% else -%>
16+
GRUB_HIDDEN_TIMEOUT_QUIET="false"
17+
<% end -%>
1118
<% end -%>
1219
GRUB_DISTRIBUTOR=<%= @distributor %>
1320
<% if @cmdline_linux_default != nil -%>

0 commit comments

Comments
 (0)