Files
s6-lua/tools/check-syntax.ps1
JMR-dev cb48a676e9 Add Lua-ported s6/s6-rc service definitions
Ports the community s6/s6-rc service catalog (early-boot mounts, udev,
dbus, session/power, networking, display managers, peripheral daemons)
to Lua-based service definitions.

- src/lua/s6lua.lua: shared helper library (exec, logging, fstab
  parsing, oneshot shell runner, readiness notification)
- src/native/s6exec.c: minimal execvp() binding so longrun `run`
  scripts can replace their own process image with the real daemon,
  since stock Lua has no exec() and os.execute("exec ...") does not
  solve it (the interpreter stays alive as an unsupervised parent)
- tools/catalog.lua + gen-services.lua: table-driven generator for
  the structurally identical -srv/-log daemon pairs and agetty ttys
- tools/lint.lua, check-syntax.ps1, set-exec-bits.ps1: local
  verification (no live s6/Linux target available this session)
- services/: 50 service directories (14 early-boot oneshots, 12
  daemon srv/log pairs, 6 agetty ttys, boot/mount/setup/ttys/
  graphical/default bundles)

Authored and syntax/structurally validated only. Native module is
unbuilt and daemon flags are unverified against Artix's real catalog
(gitea was unreachable during research) -- see docs/CONVENTIONS.md.
2026-07-19 19:06:43 -05:00

36 lines
1.3 KiB
PowerShell

# Runs luac55 -p (parse-only) over every service script and every Lua
# source file, since this Windows box has no way to actually load/execute
# anything that touches POSIX (require("s6exec"), /proc, etc.).
param()
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$luac = (Get-Command luac55 -ErrorAction SilentlyContinue).Source
if (-not $luac) { $luac = "C:\Program Files\lua-5.5.0_Win64_bin\luac55.exe" }
$scriptNames = @('run', 'up', 'down', 'finish', 'reload', 'check')
$targets = @()
$targets += Get-ChildItem -Path (Join-Path $repoRoot 'services') -Recurse -File |
Where-Object { $scriptNames -contains $_.Name }
$targets += Get-ChildItem -Path (Join-Path $repoRoot 'src') -Recurse -File -Filter '*.lua'
$targets += Get-ChildItem -Path (Join-Path $repoRoot 'tools') -Recurse -File -Filter '*.lua'
$failed = @()
foreach ($t in $targets) {
& $luac -p $t.FullName
if ($LASTEXITCODE -ne 0) {
$failed += $t.FullName
}
}
Write-Host ""
Write-Host "Checked $($targets.Count) file(s)."
if ($failed.Count -gt 0) {
Write-Host "FAILED syntax check on $($failed.Count) file(s):" -ForegroundColor Red
$failed | ForEach-Object { Write-Host " $_" -ForegroundColor Red }
exit 1
}
Write-Host "All files parsed OK." -ForegroundColor Green