Fix menuentry state in bootloader.sls 4

This commit is contained in:
LinuxSquare 2023-07-16 21:17:15 +02:00
parent e134269eb4
commit 496dbfa78d
2 changed files with 31 additions and 23 deletions

View file

@ -55,28 +55,47 @@ system_bootloader_os-release:
- key_ignore_case: False
- append_if_not_found: True
{% if salt['file.exists']('/etc/grub.d/10_linux') %}}
system_bootloader_remove_default_menuentry:
file.absent:
- name: /etc/grub.d/10_linux
- require:
- system_bootloader_install
- system_bootloader_config
{% endif %}
system_bootloader_menuentry:
file.blockreplace:
- name: /etc/grub.d/40_custom
- marker_start: "#!/bin/sh"
- marker_end: "# the 'exec tail' line above."
{% if not salt['file.exists']('/etc/grub.d/10_noveria') %}
file.managed:
- name: /etc/grub.d/10_noveria
- source: salt://{{ tpldir }}/files/bootloader_menuentry
- template: jinja
- context:
CURRENT_SUBVOLUME_TIMESTAMP_HUMAN: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}
CURRENT_SUBVOLUME_TIMESTAMP: {{ CURRENT_SUBVOLUME_TIMESTAMP }}
- prepend_if_not_found: true
- require:
- system_base_pkgs
- system_bootloader_pkgs
system_bootloader_menuentry_clean:
- system_bootloader_remove_default_menuentry
{% else %}
file.replace:
- name: /etc/grub.d/40_custom
- pattern: {{ "# the 'exec tail' line above." | regex_escape }}
- repl: null
- name: /etc/grub.d/10_noveria
- pattern: {{ "#!/bin/sh" | regex_escape }}
- "''"
- require:
- system_bootloader_menuentry
- system_base_pkgs
- system_bootloader_pkgs
file.prepend:
- name: /etc/grub.d/10_noveria
- source: salt://{{ tpldir }}/files/bootloader_menuentry
- template: jinja
- context:
CURRENT_SUBVOLUME_TIMESTAMP_HUMAN: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}
CURRENT_SUBVOLUME_TIMESTAMP: {{ CURRENT_SUBVOLUME_TIMESTAMP }}
{% endif %}
file.prepend:
- name: /etc/grub.d/10_noveria
- text: "#!/bin/sh"
system_bootloader_config:
cmd.run:
@ -85,14 +104,3 @@ system_bootloader_config:
- system_bootloader_pkgs
- system_bootloader_install
- system_bootloader_grub_dir
- system_bootloader_menuentry_clean
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: null
- require:
- system_bootloader_install
- system_bootloader_config

View file

@ -1,4 +1,4 @@
cat <<EOF
cat <<EOF
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