forked from security/hakurei
internal/rosa: register custom artifacts
This also encodes extra information for iana-etc. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -86,8 +86,27 @@ nobody:x:65534:
|
||||
// Kind returns the hardcoded [pkg.Kind] value.
|
||||
func (cureEtc) Kind() pkg.Kind { return kindEtc }
|
||||
|
||||
// Params is a noop.
|
||||
func (cureEtc) Params(*pkg.IContext) {}
|
||||
// Params writes whether iana-etc is populated.
|
||||
func (a cureEtc) Params(ctx *pkg.IContext) {
|
||||
if a.iana != nil {
|
||||
ctx.WriteUint32(1)
|
||||
} else {
|
||||
ctx.WriteUint32(0)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
pkg.Register(kindEtc, func(r *pkg.IRReader) pkg.Artifact {
|
||||
a := cureEtc{}
|
||||
if r.ReadUint32() != 0 {
|
||||
a.iana = r.Next()
|
||||
}
|
||||
if _, ok := r.Finalise(); ok {
|
||||
panic(pkg.ErrUnexpectedChecksum)
|
||||
}
|
||||
return a
|
||||
})
|
||||
}
|
||||
|
||||
// IsExclusive returns false: Cure performs a few trivial filesystem writes.
|
||||
func (cureEtc) IsExclusive() bool { return false }
|
||||
|
||||
Reference in New Issue
Block a user