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 - key_ignore_case: False
- append_if_not_found: True - 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: system_bootloader_menuentry:
file.blockreplace: {% if not salt['file.exists']('/etc/grub.d/10_noveria') %}
- name: /etc/grub.d/40_custom file.managed:
- marker_start: "#!/bin/sh" - name: /etc/grub.d/10_noveria
- marker_end: "# the 'exec tail' line above."
- source: salt://{{ tpldir }}/files/bootloader_menuentry - source: salt://{{ tpldir }}/files/bootloader_menuentry
- template: jinja - template: jinja
- context: - context:
CURRENT_SUBVOLUME_TIMESTAMP_HUMAN: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }} CURRENT_SUBVOLUME_TIMESTAMP_HUMAN: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}
CURRENT_SUBVOLUME_TIMESTAMP: {{ CURRENT_SUBVOLUME_TIMESTAMP }} CURRENT_SUBVOLUME_TIMESTAMP: {{ CURRENT_SUBVOLUME_TIMESTAMP }}
- prepend_if_not_found: true
- require: - require:
- system_base_pkgs - system_base_pkgs
- system_bootloader_pkgs - system_bootloader_pkgs
- system_bootloader_remove_default_menuentry
system_bootloader_menuentry_clean: {% else %}
file.replace: file.replace:
- name: /etc/grub.d/40_custom - name: /etc/grub.d/10_noveria
- pattern: {{ "# the 'exec tail' line above." | regex_escape }} - pattern: {{ "#!/bin/sh" | regex_escape }}
- repl: null - "''"
- require: - 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: system_bootloader_config:
cmd.run: cmd.run:
@ -85,14 +104,3 @@ system_bootloader_config:
- system_bootloader_pkgs - system_bootloader_pkgs
- system_bootloader_install - system_bootloader_install
- system_bootloader_grub_dir - 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 }}' { menuentry 'Noveria Alpine {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}' --class alpine --class gnu-linux --class os $menuentry_id_option 'alpine-{{ CURRENT_SUBVOLUME_TIMESTAMP }}' {
load_video load_video
insmod gzio insmod gzio