v0.1.1: external modules, publish YAML, proxy reset, binary-first README
- Host discovers/builds modules under modules/ (bbc, rte, tg4) - module-publish.yaml tracked; local module.yaml gitignored - drm --modules-dir / DRM_MODULES_DIR - drm proxy reset; Magisk reinject reliability - modules-v* Forgejo release workflow + build scripts - BBC full Explore channel map including S4C - README quickstart based on release binaries
This commit is contained in:
parent
1d36961a7c
commit
f9c28be3f1
52 changed files with 2915 additions and 636 deletions
62
apps/pkg/modhost/root.go
Normal file
62
apps/pkg/modhost/root.go
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package modhost
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"drmdecryption/repo"
|
||||
)
|
||||
|
||||
var (
|
||||
rootMu sync.RWMutex
|
||||
modulesDirOV string // absolute path override for the modules directory
|
||||
)
|
||||
|
||||
// SetModulesDir overrides where providers are discovered (drm --modules-dir).
|
||||
// Empty clears the override. Relative paths are resolved against the process cwd.
|
||||
func SetModulesDir(dir string) error {
|
||||
rootMu.Lock()
|
||||
defer rootMu.Unlock()
|
||||
if dir == "" {
|
||||
modulesDirOV = ""
|
||||
return nil
|
||||
}
|
||||
abs, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
modulesDirOV = abs
|
||||
return nil
|
||||
}
|
||||
|
||||
// ModulesDirOverride returns the --modules-dir override, or "".
|
||||
func ModulesDirOverride() string {
|
||||
rootMu.RLock()
|
||||
defer rootMu.RUnlock()
|
||||
return modulesDirOV
|
||||
}
|
||||
|
||||
// EffectiveModulesDir is the directory that Discover/Open scan.
|
||||
// Prefer --modules-dir / DRM_MODULES_DIR; else <root>/modules.
|
||||
func EffectiveModulesDir(root string) string {
|
||||
if ov := ModulesDirOverride(); ov != "" {
|
||||
return ov
|
||||
}
|
||||
if root == "" {
|
||||
root = repo.Root()
|
||||
}
|
||||
return filepath.Join(root, "modules")
|
||||
}
|
||||
|
||||
// ApplyEnvModulesDir sets the override from DRM_MODULES_DIR when no flag was set.
|
||||
func ApplyEnvModulesDir() error {
|
||||
if ModulesDirOverride() != "" {
|
||||
return nil
|
||||
}
|
||||
v := os.Getenv("DRM_MODULES_DIR")
|
||||
if v == "" {
|
||||
return nil
|
||||
}
|
||||
return SetModulesDir(v)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue