summaryrefslogtreecommitdiff
path: root/data/templates/grub/grub_compat.j2
blob: 935172005ceb5fd07cb1874b28ab5e2670a5824d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{# j2lint: disable=S6 #}
### Generated by VyOS image-tools v.{{ tools_version }} ###
{% macro menu_name(mode) -%}
{% if mode == 'normal' -%}
    VyOS
{%- elif mode == 'pw_reset' -%}
    Lost password change
{%- else -%}
    Unknown
{%- endif %}
{%- endmacro %}
{% macro console_name(type) -%}
{% if type == 'tty' -%}
    KVM
{%- elif type == 'ttyS' -%}
    Serial
{%- elif type == 'ttyUSB' -%}
    USB
{%- else -%}
    Unknown
{%- endif %}
{%- endmacro %}
{% macro console_opts(type) -%}
{% if type == 'tty' -%}
    console=ttyS0,115200 console=tty0
{%- elif type == 'ttyS' -%}
    console=tty0 console=ttyS0,115200
{%- elif type == 'ttyUSB' -%}
    console=tty0 console=ttyUSB0,115200
{%- else -%}
    console=tty0 console=ttyS0,115200
{%- endif %}
{%- endmacro %}
{% macro passwd_opts(mode) -%}
{% if mode == 'pw_reset' -%}
    init=/opt/vyatta/sbin/standalone_root_pw_reset
{%- endif %}
{%- endmacro %}
set default={{ default }}
set timeout={{ timeout }}
{% if console_type == 'ttyS' %}
serial --unit={{ console_num }} --speed=115200
{% else %}
serial --unit=0 --speed=115200
{% endif %}
terminal_output --append serial
terminal_input serial console
{% if efi %}
insmod efi_gop
insmod efi_uga
{% endif %}

{% for v in versions %}
menuentry "{{ menu_name(v.bootmode) }} {{ v.version }} ({{ console_name(v.console_type) }} console)" {
    linux /boot/{{ v.version }}/vmlinuz {{ v.boot_opts }} {{ console_opts(v.console_type) }} {{ passwd_opts(v.bootmode) }}
    initrd /boot/{{ v.version }}/initrd.img
}
{% endfor %}