summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/init.pp')
-rw-r--r--manifests/init.pp69
1 files changed, 37 insertions, 32 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 570b31c..8428b5c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,7 +1,20 @@
+type Bootentry = Struct[{
+ 'label' => String,
+ 'type' => Enum['linux','com'],
+ # linux specific
+ 'extra_args' => Optional[String],
+ 'initrd' => Optional[String],
+ # com specific
+ 'com' => Optional[String],
+}]
+
class syslinux (
String $kernel = 'linux',
String $efi_root = '/boot/efi',
String $bootentry = 'syslinux',
+
+ Hash[String,Bootentry,1] $boot_entries,
+ String $default_boot_entry = $boot_entries.map |$k, $_| { $k }[0],
) {
$efi_dev = $facts['mountpoints'][$efi_root]
@@ -29,41 +42,33 @@ class syslinux (
$device = $facts['mountpoints']['/']['device']
$partuuid = $facts['blkid'][$device]['PARTUUID']
- file { "${efi_root}/EFI/syslinux/syslinux.cfg":
- content => epp("${module_name}/syslinux.cfg.epp", {
- 'default' => 'arch',
- 'linux' => {
- 'arch' => {
- 'label' => 'Arch Linux',
- 'initrd' => 'initramfs-linux.img',
- 'args' => "root=PARTUUID=${partuuid} rw",
- },
- 'arch-runlevel-1' => {
- 'label' => 'Arch Linux (Runlevel 1)',
- 'initrd' => 'initramfs-linux.img',
- 'args' => "root=PARTUUID=${partuuid} rw 1",
- },
- 'archfallback' => {
- 'label' => 'Arch Linux fallback',
- 'initrd' => 'initramfs-linux-fallback.img',
- 'args' => "root=PARTUUID=${partuuid} rw",
+ $entries = $boot_entries.map |$key, $entry| {
+ case $entry['type'] {
+ 'linux': {
+ $extra_args = $entry['extra_args']
+ $initrd = $entry['initrd']
+ $hash = {
+ 'APPEND' => "root=PARTUUID=${partuuid} rw ${extra_args}",
+ 'INITRD' => "../arch/${initrd}",
+ 'LINUX' => "../arch/vmlinuz-${kernel}",
}
- },
- 'com32' => {
- 'hdt' => {
- 'label' => 'HDT (Hardware Detection Tool)',
- 'com' => 'hdt',
- },
- 'reboot' => {
- 'label' => 'Reboot',
- 'com' => 'reboot',
- },
- 'poweroff' => {
- 'label' => 'Poweroff',
- 'com' => 'poweroff',
+ }
+ 'com': {
+ $com = $entry['com']
+ $hash = {
+ 'COM32' => "${com}.c32",
}
-
}
+ }
+
+ $common = { 'MENU LABEL' => $entry['label'], }
+ [$key, $common + $hash]
+ }.convert_to(Hash)
+
+ file { "${efi_root}/EFI/syslinux/syslinux.cfg":
+ content => epp("${module_name}/syslinux.cfg.epp", {
+ 'default' => $default_boot_entry,
+ 'entries' => $entries,
})
}