diff --git a/bundles/systemd-boot/files/entry b/bundles/systemd-boot/files/entry new file mode 100755 index 0000000..00d3d8f --- /dev/null +++ b/bundles/systemd-boot/files/entry @@ -0,0 +1,13 @@ +title ${config['title']} + +% if 'linux' in config: +linux ${config['linux']} +% for line in config['initrd']: +initrd ${line} +% endfor +% if config.get('options', set()): +options ${' '.join(sorted(config['options']))} +% endif +% else: +efi ${config['efi']} +% endif diff --git a/bundles/systemd-boot/files/loader.conf b/bundles/systemd-boot/files/loader.conf new file mode 100755 index 0000000..b30de61 --- /dev/null +++ b/bundles/systemd-boot/files/loader.conf @@ -0,0 +1,5 @@ +auto-entries no +auto-firmware yes +console-mode keep +default ${config['default']} +timeout ${config.get('timeout', 5)} diff --git a/bundles/systemd-boot/files/pacman_hook b/bundles/systemd-boot/files/pacman_hook new file mode 100644 index 0000000..d65c027 --- /dev/null +++ b/bundles/systemd-boot/files/pacman_hook @@ -0,0 +1,9 @@ +[Trigger] +Type = Package +Operation = Upgrade +Target = systemd + +[Action] +Description = Gracefully upgrading systemd-boot... +When = PostTransaction +Exec = /usr/bin/systemctl restart systemd-boot-update.service diff --git a/bundles/systemd-boot/items.py b/bundles/systemd-boot/items.py new file mode 100644 index 0000000..0f26d00 --- /dev/null +++ b/bundles/systemd-boot/items.py @@ -0,0 +1,32 @@ +assert node.os == 'arch' +assert node.metadata.get('systemd-boot/default') in node.metadata.get('systemd-boot/entries') + +files = { + '/etc/pacman.d/hooks/99-systemd-boot-update': { + 'source': 'pacman_hook', + }, + '/boot/loader/loader.conf': { + 'content_type': 'mako', + 'context': { + 'config': node.metadata.get('systemd-boot'), + }, + 'mode': None, + }, +} + +directories = { + '/boot/loader/entries': { + 'purge': True, + }, +} + +for entry, config in node.metadata.get('systemd-boot/entries').items(): + files[f'/boot/loader/entries/{entry}.conf'] = { + 'source': 'entry', + 'content_type': 'mako', + 'context': { + 'entry': entry, + 'config': config, + }, + 'mode': None, + } diff --git a/nodes/kunsi-p14s.py b/nodes/kunsi-p14s.py index 5402cfb..6346334 100644 --- a/nodes/kunsi-p14s.py +++ b/nodes/kunsi-p14s.py @@ -6,6 +6,7 @@ nodes['kunsi-p14s'] = { 'lldp', 'lm-sensors', #'nfs-client', + 'systemd-boot', 'telegraf-battery-usage', 'zfs', }, @@ -122,6 +123,34 @@ nodes['kunsi-p14s'] = { 'xclip': {}, }, }, + 'systemd-boot': { + 'default': 'arch-lts', + 'entries': { + 'arch-lts': { + 'title': 'Arch Linux (LTS kernel)', + 'linux': '/vmlinuz-linux-lts', + 'initrd': [ + '/amd-ucode.img', + '/initramfs-linux-lts.img', + ], + 'options': { + 'zfs=zroot/system/root', + 'rw', + }, + }, + 'arch-lts-fallback': { + 'title': 'Arch Linux (LTS kernel, no ucode, fallback initramfs)', + 'linux': '/vmlinuz-linux-lts', + 'initrd': [ + '/initramfs-linux-lts-fallback.img', + ], + 'options': { + 'zfs=zroot/system/root', + 'rw', + }, + }, + }, + }, 'systemd-networkd': { 'enable-resolved': True, },