Feature 57 (config and provisioning): modules declare config and provisions, their files rendered from templates; synced with main (issues of feature 57, 874)
This commit is contained in:
@@ -17,7 +17,7 @@ The login manager as a module (novox/hq ADR 0208, research 026, to-be 42 phase 2
|
||||
|
||||
| path | class | what |
|
||||
|---|---|---|
|
||||
| `/etc/lemurs/config.toml` | owned (the found file is kept once, ADR 0102) | lemurs 0.4's configuration in its current format: the structure of the shipped file, every option present, as lemurs requires. The source is [`config/config.toml`](config/config.toml), carried whole in the manifest |
|
||||
| `/etc/lemurs/config.toml` | owned (the found file is kept once, ADR 0102) | lemurs 0.4's configuration in its current format: the structure of the shipped file, every option present, as lemurs requires. The source is [`files/config.toml`](files/config.toml), the file's template |
|
||||
| `/etc/lemurs/xsessions/`, `/etc/lemurs/wayland-sessions/` | owned, empty | where the configuration points lemurs for desktop entries, so none is offered |
|
||||
|
||||
**Sessions are drop-ins.** The sessions offered are the executable files session modules place in
|
||||
|
||||
@@ -73,7 +73,7 @@ func TestTheSessionsAreTheEntriesLemursOffersInItsOrder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTheModulesConfigurationIsReadAsLemursReadsIt(t *testing.T) {
|
||||
raw, err := os.ReadFile(filepath.Join("..", "..", "config", "config.toml"))
|
||||
raw, err := os.ReadFile(filepath.Join("..", "..", "files", "config.toml"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -93,11 +93,12 @@ func TestTheOfficialPackageAndItsServiceEnabledButNeverRestarted(t *testing.T) {
|
||||
func TestTheConfigurationIsTheModulesFileAndOffersOnlyTheSessionsModulesPlace(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
c := resource(t, m, "config")
|
||||
raw, _ := os.ReadFile(filepath.Join("..", "..", "config", "config.toml"))
|
||||
if c["path"] != "/etc/lemurs/config.toml" || c["content"] != string(raw) || c["into"] != nil {
|
||||
t.Fatal("the manifest carries config/config.toml whole, as an owned file")
|
||||
raw, _ := os.ReadFile(filepath.Join("..", "..", "files", "config.toml"))
|
||||
if _, inline := c["content"]; inline || c["template"] != "files/config.toml" || len(raw) == 0 ||
|
||||
c["path"] != "/etc/lemurs/config.toml" || c["into"] != nil {
|
||||
t.Fatal("the manifest takes files/config.toml whole as its template, as an owned file")
|
||||
}
|
||||
text := c["content"].(string)
|
||||
text := string(raw)
|
||||
for _, want := range []string{"[x11]", "[wayland]", `xsetup_path = "/etc/lemurs/xsetup.sh"`, `scripts_path = "/etc/lemurs/wms"`,
|
||||
`scripts_path = "/etc/lemurs/wayland"`, `xsessions_path = "/etc/lemurs/xsessions"`, `wayland_sessions_path = "/etc/lemurs/wayland-sessions"`,
|
||||
`tty = 2`, `x11_display = ":1"`, `remember = true`} {
|
||||
@@ -116,3 +117,31 @@ func TestTheConfigurationIsTheModulesFileAndOffersOnlyTheSessionsModulesPlace(t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No file resource carries its text inline: each names its template in files/, and the build packs files/
|
||||
// into the one archive the controller reads the templates back from (novox/hq ADR 0349 §2).
|
||||
func TestEveryFileTakesItsTextFromATemplate(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
for _, r := range m.Resources {
|
||||
if _, inline := r["content"]; inline {
|
||||
t.Errorf("resource %v keeps its text inline: keep it in files/ and name it as the template", r["id"])
|
||||
}
|
||||
if name, ok := r["template"].(string); ok {
|
||||
if _, err := os.Stat(filepath.Join("..", "..", name)); err != nil {
|
||||
t.Errorf("resource %v names %s: %v", r["id"], name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
packs := 0
|
||||
for _, a := range m.Build.Artifacts {
|
||||
if a["kind"] == "archive" && a["from"] == "files" {
|
||||
packs++
|
||||
if a["name"] != "files" {
|
||||
t.Errorf("the templates archive is named %v, not files", a["name"])
|
||||
}
|
||||
}
|
||||
}
|
||||
if packs != 1 {
|
||||
t.Errorf("the build packs files/ into %d archives, not one", packs)
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# The X server as lemurs starts it, written by the mesh (module lemurs). Replaced at every push.
|
||||
#
|
||||
# -noreset: without it, X resets whenever its last client disconnects, and a reset empties the
|
||||
# resource database. The session's start merges the X resources with xrdb before any long-lived
|
||||
# client is connected, so the server reset twice in the four seconds after a login and threw the
|
||||
# resources away: xterm fell back to the bitmap "fixed" font, without the mesh's face and colours.
|
||||
exec /usr/bin/X "$@" -noreset
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user