-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathunraid.xml.j2
More file actions
184 lines (183 loc) · 11.5 KB
/
unraid.xml.j2
File metadata and controls
184 lines (183 loc) · 11.5 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{#- Create a real object from repo_vars -#}
{%- set better_vars={} -%}
{%- for i in repo_vars -%}
{%- set i=(i | replace(' = ', '=', 1) | replace('=', '¯\_(ツ)_/¯', 1) | replace("'", "") | replace('"', "")).split('¯\_(ツ)_/¯') -%}
{%- set x=(better_vars.__setitem__(i[0], i[1])) -%}
{%- endfor -%}
{#- Create a real object from repo_vars -#}
{#- Create ExtraParam for REQUIRED stuff-#}
{%- set ExtraParam=[] -%}
{%- set x=ExtraParam.append("--hostname=" + param_hostname) if param_usage_include_hostname is sameas true -%}
{%- set x=ExtraParam.append("--mac-address=" + param_mac_address) if param_usage_include_mac_address is sameas true -%}
{%- if cap_add_param is defined -%}
{%- for item in cap_add_param_vars -%}
{%- set x=ExtraParam.append("--cap-add=" + item.cap_add_var) -%}
{%- endfor -%}
{#- custom_params -#}
{%- if custom_params is defined -%}
{%- for item in custom_params -%}
{%- if item.array is not defined -%}
{%- set x=ExtraParam.append("--" + item.name+ "=" + item.value) -%}
{%- else -%}
{%- for item2 in item.value -%}
{%- set x=ExtraParam.append("--" + item.name+ "=" + item2) -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- if security_opt_param is defined -%}
{%- for item in security_opt_param_vars -%}
{%- set x=ExtraParam.append("--security-opt " + item.run_var) -%}
{%- endfor -%}
{%- endif -%}
{%- macro ca(str) -%}
{{ str | replace("<", "") | replace(">", "") | replace("[", "") | replace("]", "") | replace("&", "and") | e }}
{%- endmacro -%}
{%- macro readme_date(str) -%}
{%- set _date = (str | replace(":","")).split(".") -%}
{{ "20" + _date[2] + "-" + _date[1] + "-" + _date[0] }}
{%- endmacro -%}
{%- macro mask(str) -%}
{{ "true" if ["token", "pass" ,"key"]|select("in", str|lower) else "false" }}
{%- endmacro -%}
{#- Create ExtraParam for REQUIRED stuff-#}
<?xml version="1.0"?>
<!-- DO NOT CHANGE THIS FILE MANUALLY, IT IS AUTOMATICALLY GENERATED -->
<!-- GENERATED FROM {{ project_github_asset }}/readme-vars.yml -->
<Container version="2">
<Name>{{ param_container_name | lower }}</Name>
<Repository>lscr.io/{{ lsio_project_name_short }}/{{ project_name }}</Repository>
<Registry>https://github.com/orgs/{{ lsio_project_name_short }}/packages/container/package/{{ project_name }}</Registry>
<DonateText>Donations</DonateText>
<DonateLink>https://www.linuxserver.io/donate</DonateLink>
<DonateImg>https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/donate.png</DonateImg>
<Network>{{ param_net if param_usage_include_net is sameas true else 'bridge' }}</Network>
<Privileged>{{ "true" if privileged is sameas true else "false" }}</Privileged>
<Support>{{ project_github_repo_url }}/issues/new/choose</Support>
<Shell>bash</Shell>
{% if project_deprecation_status %}
<Deprecated>true</Deprecated>
{% endif %}
<GitHub>{{ project_github_repo_url }}{{ "#application-setup" if app_setup_block_enabled is defined and app_setup_block_enabled }}</GitHub>
<ReadMe>{{ project_github_repo_url }}{{ "#readme" }}</ReadMe>
{# Set the Branches, if any Config items is overwritten. TODO: handle config items #}
{% if development_versions is defined and development_versions is sameas true %}
{% for item in development_versions_items if not "deprecate" in item.desc.lower() %}
<Branch>
<Tag>{{ ca(item.tag) }}</Tag>
<TagDescription>{{ ca(item.desc) }}</TagDescription>
{% if item.tag != "latest" %}
<ReadMe>{{ project_github_repo_url }}{{ "/tree/" + item.tag + "#readme" }}</ReadMe>
<GitHub>{{ project_github_repo_url }}{{ ("/tree/" + item.tag + "#application-setup") if app_setup_block_enabled is defined and app_setup_block_enabled }}</GitHub>
{% endif %}
{% if item.extra is defined %} {#- Allow for branch-specific stuff #}
{{ ca(item.extra) | indent(8) | trim }}
{% endif %}
</Branch>
{% endfor %}
{% endif %}
{# Set the Branches, if any #}
<Project>{{ project_url }}</Project>
<Overview>{{ ca(project_blurb) | trim }}</Overview>
{# Set the ExtraParmas, if any #}
{% if ExtraParam is defined and ExtraParam!=[] %}
<ExtraParams>{{ ExtraParam | join(" ") }}</ExtraParams>
{% endif %}
{# Set the WebUI link based on the link the CI runs against #}
{% if better_vars.get("CI_WEB") == "true" and better_vars.get("CI") == "true" %}
<WebUI>{{ "https" if better_vars.get("CI_SSL") == "true" else "http" }}://[IP]:[PORT:{{ better_vars.get("CI_PORT") }}]{{ better_vars.get("CI_WEBPATH") }}</WebUI>
{% endif %}
{# Set the WebUI link based on the link the CI runs against #}
<TemplateURL>{{ "false" if unraid_template_sync is sameas false else "https://raw.githubusercontent.com/linuxserver/templates/main/unraid/" + project_name | lower + ".xml" }}</TemplateURL>
<Icon>https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver-ls-logo.png</Icon>
{% if (unraid_requirement is defined and unraid_requirement != "") or (external_application_snippet_enabled) or (selkies_blurb is defined) %}
<Requires>
{% if unraid_requirement is defined %}
{{ unraid_requirement | indent(4) | trim }}
{% endif %}
{% if external_application_snippet_enabled %}
This container requires an external application to be run separately.
{{ external_application_unraid_block | indent(4) | trim }}
{% endif %}
{% if selkies_blurb is defined %}
This image is unprotected by default __**do not**__ expose it to the internet.
Please read {{ project_github_repo_url }}#security for more information.
{% endif %}
</Requires>
{% endif %}
{# Create changelog #}
{% if changelogs is defined and changelogs %}
<Date>{{ readme_date(changelogs |map(attribute='date') | first) }}</Date>
<Changes>
{% for item in changelogs %}
### {{ readme_date( item.date ) }}
- {{ ca(item.desc) }}
{% endfor %}
</Changes>
{% endif %}
{# Set required ports, gets the name from the name atribute if present, or "WebUI" if it is the first port #}
{% if param_usage_include_ports | default(false) %}
{% for item in param_ports %}
{% set port, proto=item.internal_port.split('/') if "/" in item.internal_port else [item.internal_port, false] %} {#- Logic to get the protocol #}
<Config Name="{{ ca(item.name) if item.name is defined else "WebUI" if loop.first else "Port: " + port }}" Target="{{ port }}" Default="{{ ca(item.external_port) }}" Mode="{{ proto if proto else "tcp" }}" Description="{{ ca(item.port_desc) if item.port_desc is defined else "Container Port: " + port }}" Type="Port" Display="always" Required="true" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set required ports, gets the name from the name atribute if present, or "WebUI" if it is the first port #}
{#- Set optional ports #}
{% if opt_param_usage_include_ports | default(false) %}
{% for item in opt_param_ports %}
{% set port, proto=item.internal_port.split('/') if "/" in item.internal_port else [item.internal_port, false] %} {#- Logic to get the protocol #}
<Config Name="{{ ca(item.name) if item.name is defined else "Port: " + port }}" Target="{{ port }}" Default="{{ ca(item.external_port) }}" Mode="{{ proto if proto else "tcp" }}" Description="{{ ca(item.port_desc) if item.port_desc is defined else "Container Port: " + port }}" Type="Port" Display="always" Required="false" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set optional ports #}
{#- Set required volumes, gets the name from the name atribute if present, or "Appdata" if it is the /config location #}
{% if param_usage_include_vols | default(false) %}
{% for item in param_volumes %}
{% set path, mode=item.vol_path.split(':') if ":" in item.vol_path else [item.vol_path, false] %} {#- Logic to get the mode #}
<Config Name="{{ ca(item.name) if item.name is defined else "Appdata" if path == "/config" else "Path: " + path }}" Target="{{ ca(path) }}" Default="{{ ca(item.vol_host_path) if item.default is defined and item.default is sameas true }}" Mode="{{ mode if mode else "rw" }}" Description="{{ ca(item.desc) if item.desc is defined else "Path: " + path }}" Type="Path" Display="{{ "advanced" if path == "/config" else "always" }}" Required="true" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set required volumes, gets the name from the name atribute if present, or "Appdata" if it is the /config location #}
{#- Set optional volumes #}
{% if opt_param_usage_include_vols | default(false) %}
{% for item in opt_param_volumes %}
{% set path, mode=item.vol_path.split(':') if ":" in item.vol_path else [item.vol_path, false] %} {#- Logic to get the mode #}
<Config Name="{{ ca(item.name) if item.name is defined else "Appdata" if path == "/config" else "Path: " + path }}" Target="{{ ca(path) }}" Default="{{ ca(item.vol_host_path) if item.default is defined and item.default is sameas true }}" Mode="{{ mode if mode else "rw" }}" Description="{{ ca(item.desc) if item.desc is defined else "Path: " + path }}" Type="Path" Display="always" Required="false" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set optional volumes #}
{% set skip_envs=["puid", "pgid", "tz", "umask"] %} {#- Drop envs that are either hardcoded, or automaticcly added by unraid #}
{#- Set required variables, gets the name from the name atribute #}
{% if param_usage_include_env | default(false) %}
{% for item in param_env_vars if not item.env_var | lower is in skip_envs %}
<Config Name="{{ ca(item.name) if item.name is defined else item.env_var }}" Target="{{ item.env_var }}" Default="{{ item.env_options | join('|') if item.env_options is defined else ca(item.env_value) }}" Description="{{ ca(item.desc) if item.desc is defined else "Variable: " + path }}" Type="Variable" Display="always" Required="true" Mask="{{ mask(item.env_var) }}"/>
{% endfor %}
{% endif %}
{#- Set required variables, gets the name from the name atribute #}
{#- Set optional variables #}
{% if opt_param_usage_include_env | default(false) %}
{% for item in opt_param_env_vars if not item.env_var | lower is in skip_envs %}
<Config Name="{{ ca(item.name) if item.name is defined else item.env_var }}" Target="{{ item.env_var }}" Default="{{ ca(item.env_value) }}" Description="{{ ca(item.desc) if item.desc is defined else "Variable: " + path }}" Type="Variable" Display="always" Required="false" Mask="{{ mask(item.env_var) }}"/>
{% endfor %}
{% endif %}
{#- Set optional variables #}
<Config Name="PUID" Target="PUID" Default="99" Description="Container Variable: PUID" Type="Variable" Display="advanced" Required="true" Mask="false"/>
<Config Name="PGID" Target="PGID" Default="100" Description="Container Variable: PGID" Type="Variable" Display="advanced" Required="true" Mask="false"/>
<Config Name="UMASK" Target="UMASK" Default="022" Description="Container Variable: UMASK" Type="Variable" Display="advanced" Required="false" Mask="false"/>
{# Set required devices, gets the name from the name atribute #}
{% if param_device_map | default(false) %}
{% for item in param_devices %}
<Config Name="{{ ca(item.name) if item.name is defined else item.device_path }}" Default="{{ item.device_path }}" Description="{{ ca(item.desc) if item.desc is defined else "Device: " + path }}" Type="Device" Display="always" Required="true" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set required variables, gets the name from the name atribute #}
{#- Set optional devices #}
{% if opt_param_device_map | default(false) %}
{% for item in opt_param_devices %}
<Config Name="{{ ca(item.name) if item.name is defined else item.device_path }}" Default="{{ item.device_path }}" Description="{{ ca(item.desc) if item.desc is defined else "Device: " + path }}" Type="Device" Display="always" Required="false" Mask="false"/>
{% endfor %}
{% endif %}
{#- Set optional devices #}
</Container>