diff --git a/system/bootloader.sls b/system/bootloader.sls index 4dc5b1b..af8dc27 100644 --- a/system/bootloader.sls +++ b/system/bootloader.sls @@ -52,7 +52,6 @@ system_bootloader_mkinitfs_conf: - require: - system_base_pkgs - system_bootloader_pkgs - - system_bootloader_install system_bootloader_os-release: file.keyvalue: @@ -63,14 +62,33 @@ system_bootloader_os-release: - uncomment: '# ' - key_ignore_case: False - append_if_not_found: True - - require: - - system_base_pkgs - - system_bootloader_pkgs -system_bootloader_cmdline: - file.append: - - name: /etc/default/grub - - text: 'GRUB_CMDLINE_LINUX_DEFAULT="root="LABEL=ROOT" rootflags=subvol=@root_{{ CURRENT_SUBVOLUME_TIMESTAMP }} lockdown=confidentiality"' +system_bootloader_remove_default_menuentry: + file.blockreplace: + - name: /efi/grub/grub.cfg + - marker_start: "### BEGIN /etc/grub.d/10_linux ###" + - marker_end: "### END /etc/grub.d/10_linux ###" + - content: "" + - require: + - system_bootloader_install + - system_bootloader_config + +{% CUSTOM_MENUENTRY_HEADER = salt['cmd.shell']('head -n5 /etc/grub.d/40_custom') %} + +system_bootloader_menuentry: + file.blockreplace: + - name: /etc/grub.d/40_custom + - marker_start: "#!/bin/sh" + - marker_end: "# the 'exec tail' line above." + - source: salt://{{ tpldir }}/files/bootloader_menuentry + - template: jinja + - context: + CURRENT_SUBVOLUME_TIMESTAMP_HUMAN: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }} + CURRENT_SUBVOLUME_TIMESTAMP: {{ CURRENT_SUBVOLUME_TIMESTAMP }} - require: - system_base_pkgs - system_bootloader_pkgs + - system_bootloader_remove_default_menuentry + file.append: + - name: /etc/grub.d/40_custom + - content: {{ CUSTOM_MENUENTRY_HEADER }} diff --git a/system/files/bootloader_menuentry b/system/files/bootloader_menuentry new file mode 100644 index 0000000..99a0674 --- /dev/null +++ b/system/files/bootloader_menuentry @@ -0,0 +1,11 @@ +menuentry 'Noveria Alpine {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}' --class alpine --class gnu-linux --class os $menuentry_id_option 'alpine-{{ CURRENT_SUBVOLUME_TIMESTAMP }}' { + load_video + insmod gzio + insmod part_gpt + insmod btrfs + search --nofloppy --label --set=root ROOT + echo 'Loading Linuzx lts ...' + linux /@root_{{ CURRENT_SUBVOLUME_TIMESTAMP }}/boot/vmlinuz-lts root=LABEL=ROOT rootflags=subvol=@root_{{ CURRENT_SUBVOLUME_TIMESTAMP }} lockdown=confidentiality + echo 'Loading initial ramdisk ...' + initrd /@root_{{ CURRENT_SUBVOLUME_TIMESTAMP }}/boot/initramfs-lts +}