container/fhs: move pathname constants
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m6s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m29s
Test / Hakurei (race detector) (push) Successful in 3m5s
Test / Hakurei (push) Successful in 2m10s
Test / Flake checks (push) Successful in 1m21s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m6s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m29s
Test / Hakurei (race detector) (push) Successful in 3m5s
Test / Hakurei (push) Successful in 2m10s
Test / Flake checks (push) Successful in 1m21s
This allows referencing FHS pathnames without importing container. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
41
container/fhs/abs.go
Normal file
41
container/fhs/abs.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package fhs
|
||||
|
||||
import (
|
||||
_ "unsafe"
|
||||
|
||||
"hakurei.app/container/check"
|
||||
)
|
||||
|
||||
/* constants in this file bypass abs check, be extremely careful when changing them! */
|
||||
|
||||
//go:linkname unsafeAbs hakurei.app/container/check.unsafeAbs
|
||||
func unsafeAbs(_ string) *check.Absolute
|
||||
|
||||
var (
|
||||
// AbsRoot is [Root] as [check.Absolute].
|
||||
AbsRoot = unsafeAbs(Root)
|
||||
// AbsEtc is [Etc] as [check.Absolute].
|
||||
AbsEtc = unsafeAbs(Etc)
|
||||
// AbsTmp is [Tmp] as [check.Absolute].
|
||||
AbsTmp = unsafeAbs(Tmp)
|
||||
|
||||
// AbsRun is [Run] as [check.Absolute].
|
||||
AbsRun = unsafeAbs(Run)
|
||||
// AbsRunUser is [RunUser] as [check.Absolute].
|
||||
AbsRunUser = unsafeAbs(RunUser)
|
||||
|
||||
// AbsUsrBin is [UsrBin] as [check.Absolute].
|
||||
AbsUsrBin = unsafeAbs(UsrBin)
|
||||
|
||||
// AbsVar is [Var] as [check.Absolute].
|
||||
AbsVar = unsafeAbs(Var)
|
||||
// AbsVarLib is [VarLib] as [check.Absolute].
|
||||
AbsVarLib = unsafeAbs(VarLib)
|
||||
|
||||
// AbsDev is [Dev] as [check.Absolute].
|
||||
AbsDev = unsafeAbs(Dev)
|
||||
// AbsProc is [Proc] as [check.Absolute].
|
||||
AbsProc = unsafeAbs(Proc)
|
||||
// AbsSys is [Sys] as [check.Absolute].
|
||||
AbsSys = unsafeAbs(Sys)
|
||||
)
|
||||
Reference in New Issue
Block a user