feat: drop-in support for custom templates

User templates can now be added without rebuilding: drop a script into
~/.config/motd-assist/templates/ and reference it from a preset via
"install": "<filename>". Same-name files override built-ins; new files
are picked up by the running TUI via 'r'. `motd-assist templates` lists
known templates and creates the drop-in directory.

Apply plans now embed the resolved template content (Plan.ResolveContents)
so the sudo/root process never needs to read user config; snapshots store
installed script content so restore works under sudo as well. Validation
rejects plans with unresolved content.
This commit is contained in:
Tronax 2026-08-31 10:31:58 +02:00
parent d56659e21a
commit 303c49b484
Signed by: Tronax
SSH key fingerprint: SHA256:2pKKXDZucWvaF/GzXNz0FY53EAO1YDLN80bqS+TTz/o
10 changed files with 375 additions and 48 deletions

View file

@ -31,7 +31,8 @@ type (
}
InstallOp struct {
Name string `json:"name"`
Source string `json:"source"`
Source string `json:"source,omitempty"`
Content string `json:"content,omitempty"`
Enabled bool `json:"enabled"`
}
RemoveOp struct {