Skip to content

Commit dd4e68e

Browse files
committed
docs(plg-file): enhance attribute case sensitivity guidance and clarify <FILE> processing details
1 parent 1192264 commit dd4e68e

1 file changed

Lines changed: 42 additions & 9 deletions

File tree

docs/plg-file.md

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ nav_order: 3
1212
1313
The `.plg` file is the heart of every Unraid plugin. It's an XML document that tells the plugin system how to install, update, and remove your plugin.
1414

15+
{: .warning }
16+
> Attribute case matters in practice. Use the documented attribute names exactly.
17+
>
18+
> - Top-level `<PLUGIN>` attributes such as `min` and `max` are lowercase.
19+
> - `<FILE>` attributes are mixed-case in the current plugin manager implementation, for example `Name`, `Run`, `Method`, `Mode`, `Type`, `Min`, and `Max`.
20+
> - In particular, `<FILE ... Max="6.12.99">` works, while lowercase `<FILE ... max="6.12.99">` may be ignored.
21+
1522
## Basic Structure
1623

1724
```xml
@@ -97,8 +104,8 @@ The `<PLUGIN>` tag supports these attributes:
97104
| `support` | URL to support thread for the plugin (Unraid 6.6+; shown in Plugins page). |
98105
| `project` | Project home page (usually GitHub). |
99106
| `readme` | README URL or path for plugin details display. |
100-
| `min` | Minimum Unraid version required (e.g., `"6.9.0"`). |
101-
| `max` | Maximum Unraid version supported. |
107+
| `min` | Minimum Unraid version required on the top-level `<PLUGIN>` tag (e.g., `"6.9.0"`). |
108+
| `max` | Maximum Unraid version supported on the top-level `<PLUGIN>` tag. |
102109

103110
> ### Compatibility notes
104111
>
@@ -131,6 +138,13 @@ This is displayed in the Plugin Manager when viewing plugin details.
131138

132139
`<FILE>` elements define files to download, create, or run scripts.
133140

141+
The plugin manager processes `<FILE>` elements in document order.
142+
143+
- A `<FILE>` block with `<URL>` downloads to the target `Name` path.
144+
- A later `<FILE>` block with `<LOCAL>` copies from an already-existing local path.
145+
- `<LOCAL>` is just a filesystem copy. It does not fetch a URL by itself.
146+
- If the destination file already exists, the plugin manager skips recreating it unless a supplied checksum fails, in which case the old file is removed and the block is retried.
147+
134148
### Download a File
135149

136150
```xml
@@ -144,6 +158,17 @@ This is displayed in the Plugin Manager when viewing plugin details.
144158

145159
Unraid supports both SHA256 and MD5 for file verification:
146160

161+
Behavior in the current plugin manager implementation:
162+
163+
- `SHA256` takes precedence over `MD5` when both are present on the same `<FILE>` block.
164+
- If the destination file already exists, the plugin manager checks `SHA256` or `MD5` before deciding whether to skip the block.
165+
- If the existing file hash matches, the block is skipped.
166+
- If the existing file hash does not match, the existing file is removed and the block is retried.
167+
- For `<FILE>` blocks with `<URL>`, the downloaded file is verified again after download, and installation aborts if the checksum is wrong.
168+
- For `<FILE>` blocks using `<LOCAL>` or `<INLINE>`, the checksum mainly controls whether an existing destination is reused or removed first. There is no second post-create checksum verification step for a newly created local or inline file.
169+
170+
Use `SHA256` and `MD5` exactly as shown here. These element names are case-sensitive in practice.
171+
147172
```xml
148173
<!-- Preferred: SHA256 (more secure) -->
149174
<FILE Name="/boot/config/plugins/myplugin/myfile.txz">
@@ -208,18 +233,18 @@ exit 0
208233
</FILE>
209234
```
210235

211-
### Version-Gated Sections with `min` and `max`
236+
### Version-Gated Sections with `Min` and `Max`
212237

213-
Individual `<FILE>` sections support `min` and `max` attributes to conditionally execute or download based on OS version.
238+
Individual `<FILE>` sections support `Min` and `Max` attributes to conditionally execute or download based on OS version.
214239

215240
```xml
216241
<!-- Only processed on Unraid 7.0.0+ -->
217-
<FILE Name="/boot/config/plugins/myplugin/newer-only.txz" min="7.0.0">
242+
<FILE Name="/boot/config/plugins/myplugin/newer-only.txz" Min="7.0.0">
218243
<URL>https://example.com/newer-only.txz</URL>
219244
</FILE>
220245

221246
<!-- Only processed on Unraid 6.12.x and below -->
222-
<FILE Run="/bin/bash" max="6.12.99">
247+
<FILE Run="/bin/bash" Max="6.12.99">
223248
<INLINE>
224249
echo "Legacy compatibility step"
225250
</INLINE>
@@ -244,6 +269,14 @@ The `<LOCAL>` element copies a previously downloaded file:
244269

245270
This caches files on the USB flash so they don't need to be re-downloaded on each boot.
246271

272+
Important details:
273+
274+
- The source path referenced by `<LOCAL>` must already exist when that `<FILE>` block runs.
275+
- The destination file is skipped if it already exists, unless you supplied a checksum and the checksum mismatch causes the destination to be removed first.
276+
- If you add `SHA256` or `MD5` to a `<LOCAL>` block, it helps invalidate a stale destination file, but it does not add a second post-copy verification pass.
277+
- For simple static assets this pattern works well.
278+
- For more complex fallback flows, an explicit shell script that checks for a cached file, downloads it if missing, and then copies or extracts it can be easier to reason about than chaining multiple `<FILE>` blocks.
279+
247280
### Embedding Base64 Content
248281

249282
For small files like icons, you can embed them directly in the PLG file using base64 encoding:
@@ -523,7 +556,7 @@ If your plugin installs shared dependencies like `perl`, `python`, or `java` pac
523556

524557
Define version, URLs, and paths as entities so you only update them in one place.
525558

526-
### 3. Always Include Integrity Checksums
559+
### 5. Always Include Integrity Checksums
527560

528561
This ensures file integrity and helps with caching. Use SHA256 for new plugins:
529562

@@ -548,7 +581,7 @@ sha256sum file.txz # SHA256 (recommended)
548581
md5sum file.txz # MD5 (legacy)
549582
```
550583

551-
### 4. Clean Up Old Versions
584+
### 6. Clean Up Old Versions
552585

553586
In your pre-install script, remove old package versions:
554587

@@ -598,7 +631,7 @@ or
598631
```
599632

600633
- If the file does not exist, the CA item may still be shown, but install/reinstall actions can be disabled until the path appears.
601-
- `min`/`max` version attributes in the PLG still take precedence when evaluating overall eligibility.
634+
- Top-level `min`/`max` attributes on `<PLUGIN>` still take precedence when evaluating overall eligibility.
602635

603636
{: .note }
604637
> Source: Community Applications plugin template guidance from Squid (Unraid forum): [https://forums.unraid.net/topic/38619-docker-template-xml-schema/page/3/#comment-1015826](https://forums.unraid.net/topic/38619-docker-template-xml-schema/page/3/#comment-1015826)

0 commit comments

Comments
 (0)