Skip to content

Commit 226565b

Browse files
committed
docs(plg-file): enhance PLG file reference with additional attributes and compatibility notes
1 parent 2e01b80 commit 226565b

1 file changed

Lines changed: 134 additions & 11 deletions

File tree

docs/plg-file.md

Lines changed: 134 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ layout: default
33
title: PLG File Reference
44
nav_order: 3
55
---
6-
<!-- markdownlint ignore MD022 -->
76
# PLG File Reference
87

98
{: .note }
@@ -94,10 +93,18 @@ The `<PLUGIN>` tag supports these attributes:
9493
| Attribute | Description |
9594
| --------- | ----------- |
9695
| `launch` | Menu path to open after installation. Format: `MenuSection/PageTitle` |
97-
| `icon` | FontAwesome icon name (without `fa-` prefix) for Plugin Manager. |
96+
| `icon` | FontAwesome icon name (without `fa-` prefix) for Plugin Manager (Unraid 6.4+; 6.7+ supports `icon` on `<PLUGIN>` too). |
97+
| `support` | URL to support thread for the plugin (Unraid 6.6+; shown in Plugins page). |
98+
| `project` | Project home page (usually GitHub). |
99+
| `readme` | README URL or path for plugin details display. |
98100
| `min` | Minimum Unraid version required (e.g., `"6.9.0"`). |
99101
| `max` | Maximum Unraid version supported. |
100102

103+
> ### Compatibility notes
104+
>
105+
> - `category` is deprecated starting around v6b11/v6b12 and should not be required for new plugins.
106+
> - `system="true"` is a plugin manager extension idea used to install into `/boot/plugins` (system plugins), instead of `/boot/config/plugins`.
107+
101108
Clicking a plugin name in the Plugins page opens the details panel:
102109

103110
![Plugin details panel](../assets/images/screenshots/apps-plugins-details.png)
@@ -274,6 +281,23 @@ The `Method` attribute controls when a FILE element is processed:
274281
| (none) | During install only |
275282
| `install` | During install (explicit) |
276283
| `remove` | During plugin removal only |
284+
| `update` | During plugin update (v6) |
285+
286+
### Update Method
287+
288+
To support plugin upgrades cleanly, you can provide a file block specifically for update actions. Use `Method="update"` to remove stale files or pre-clean path before reinstall:
289+
290+
```xml
291+
<FILE Run="/bin/bash" Method="update">
292+
<INLINE>
293+
# remove old unpacked content and avoid stale legacy leftovers
294+
rm -rf /usr/local/emhttp/plugins/&name;
295+
rm -rf /boot/config/plugins/&name;
296+
</INLINE>
297+
</FILE>
298+
```
299+
300+
`Method="update"` is run only when plugin manager performs an update, not on first install.
277301

278302
### Install-Only Script
279303

@@ -409,6 +433,70 @@ echo ""
409433
</PLUGIN>
410434
```
411435

436+
## Dynamix tabs and plugin menu behavior
437+
438+
For Dynamix-based UIs, a plugin can expose tabs and settings entries as follows:
439+
440+
- Parent page should be a menu container with `Tabs="true"`.
441+
- Child pages use `Menu="ParentName:1"`, `Menu="ParentName:2"` to control order.
442+
- Page icons appear as 16x16 in `/usr/local/emhttp/plugins/&name;/icons/<lowercase-title-without-spaces>.png`.
443+
- `Icon="XXX"` in the page header defines the page icon (48x48 or font-awesome token). For tabbed visuals, verify both `images` and `icons` entries.
444+
445+
Example:
446+
447+
```xml
448+
Menu="OtherSettings"
449+
Type="xmenu"
450+
Title="APC UPS"
451+
Icon="apcupsd.png"
452+
Tabs="true"
453+
---
454+
<?php
455+
// page content
456+
?>
457+
```
458+
459+
Child tab page example:
460+
461+
```xml
462+
Menu="APC UPS:1"
463+
Title="Status"
464+
---
465+
<?php
466+
// status content
467+
?>
468+
```
469+
470+
git is used by the icon link on the main Plugins page:
471+
472+
- Plugin manager uses the plugin name and `.page` file matching this name to provide click behavior.
473+
- If `.page` isn’t present or not matched, the icon may be non-clickable or pointer goes to a blank route.
474+
475+
## Unraid event hook versions
476+
477+
Unraid event handler paths may differ by versions:
478+
479+
- older integration in v6 used `disks_mounted`, `unmounting_disks` for disk life cycle
480+
- 6.6+ and beyond prefer `started`, `stopping_svcs` for services startup/shutdown relative to Docker/VMs
481+
482+
Place event scripts in `/etc/rc.d/` appropriately, and avoid depending on only one set when targeting both v5/v6.
483+
484+
## Running background services from plugin install
485+
486+
If a plugin starts long-running background processes during installation, the install UI may hang waiting for completion. Use techniques to detach processes safely:
487+
488+
```xml
489+
<FILE Run="/bin/bash">
490+
<INLINE>
491+
nohup /usr/local/emhttp/plugins/&name;/my-daemon.sh &
492+
# or scheduling with at
493+
at -f /tmp/start_my_daemon.sh now
494+
</INLINE>
495+
</FILE>
496+
```
497+
498+
The `at` method is often recommended for service startup at the end of plugin install so the install appears to finish cleanly.
499+
412500
## Best Practices
413501

414502
### 1. Use Consistent Naming
@@ -420,7 +508,18 @@ The plugin name, folder names, and package name should all match:
420508
- emhttp folder: `/usr/local/emhttp/plugins/myplugin/`
421509
- Package: `myplugin-package-VERSION.txz`
422510

423-
### 2. Use Entities for Maintenance
511+
### 2. Manage shared dependencies carefully
512+
513+
If your plugin installs shared dependencies like `perl`, `python`, or `java` packages into `/boot/packages`, avoid removing dependency files during `remove` unless you are sure no other plugin still needs them.
514+
515+
- Prefer leaving shared packages in place by default and relying on plugin manager / user cleanup for flash space.
516+
- Provide documentation in the plugin README on how to reclaim package files if needed.
517+
518+
### 3. Keep plugin registration clean
519+
520+
`/var/log/plugins` contains plugin manager references to installed plugins (symlinks). Do not manipulate this directory directly — use installer scripts and plugin manager actions.
521+
522+
### 4. Use Entities for Maintenance
424523

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

@@ -469,17 +568,40 @@ If your plugin requires specific Unraid features:
469568
<PLUGIN ... min="6.9.0">
470569
```
471570

472-
### 6. Optional Community Applications requirements (CA)
571+
### 6. Optional dependency hints (Community Applications)
473572

474-
Community Applications supports additional plugin dependency hints that are read from plugin metadata (and are useful for app feed behavior):
573+
Community Applications supports optional metadata hints that can influence app feed visibility and install/reinstall eligibility:
475574

476-
- `<Requires>` (optional) — other plugin names/IDs that are expected to exist before this plugin is useful.
477-
- `<RequiresFile>` (optional) — a filesystem path to a file to verify before enabling install/reinstall actions.
478-
- Example: `<RequiresFile>/var/log/plugins/unassigned.devices.plg</RequiresFile>`
479-
- If the file does not exist, the plugin may still be shown, but install/reinstall buttons are disabled until the dependency appears.
480-
- `min`/`max` version controls in the PLG still take precedence when evaluating eligibility.
575+
- `<Requires>` (optional) — dependency hints (plugin names/IDs or textual requirements) used by CA to suggest prerequisites.
576+
- `<RequiresFile>` (optional) — a filesystem path checked by CA; if absent, install/reinstall buttons may be disabled for this entry.
481577

482-
> Source: Community Applications plugin template guidance from Squid (Unraid forum): https://forums.unraid.net/topic/42808-plugin-templates-for-ca-appstore/
578+
For example, UI text in `<Requires>` can include Markdown and alternative requirements, which is useful for complex dependency scenarios:
579+
580+
```xml
581+
<Requires>
582+
**Nvidia Driver plugin** (nVidia Support) *or*
583+
**Intel GPU TOP plugin** (Intel Support) *or*
584+
**AMD Driver** and **RadeonTop plugins** (AMD Support)
585+
</Requires>
586+
```
587+
588+
A simple CA dependency example:
589+
590+
```xml
591+
<Requires>Unassigned Devices</Requires>
592+
```
593+
594+
or
595+
596+
```xml
597+
<RequiresFile>/var/log/plugins/unassigned.devices.plg</RequiresFile>
598+
```
599+
600+
- 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.
602+
603+
{: .note }
604+
> 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)
483605
484606
### 7. Include All Required URLs
485607

@@ -515,6 +637,7 @@ Error entries show the specific issue that occurred:
515637
### Files Not Found After Reboot
516638

517639
Files in `/usr/local/emhttp/` are in RAM. They must be:
640+
518641
- Inside a `.txz` package that's installed, OR
519642
- Created by an install script that runs on every boot, OR
520643
- Cached on flash and copied via `<LOCAL>`

0 commit comments

Comments
 (0)