talos/internal/pkg/extensions/extensions.go
Noel Georgi d4b8b35de7
feat: generate kernel module dependency tree
Run `depmod` during install/upgrades when extensions provide kernel
modules and `modules.dep` needs to be re-generated. This also allows
modules of same name from kernel to co-exist. Modules in `extras`
folder takes precedence over `in-built` ones.

Signed-off-by: Noel Georgi <git@frezbo.dev>
2023-01-19 18:54:10 +05:30

34 lines
784 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package extensions provides function to manage system extensions.
package extensions
import (
"path/filepath"
"github.com/siderolabs/talos/pkg/machinery/extensions"
)
// Extension represents unpacked extension in the filesystem.
type Extension struct {
Manifest extensions.Manifest
directory string
rootfsPath string
}
func newExtension(rootfsPath, directory string) *Extension {
extension := &Extension{
rootfsPath: rootfsPath,
directory: directory,
}
if extension.directory == "" {
extension.directory = filepath.Base(rootfsPath)
}
return extension
}