mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 19:16:59 +00:00
Enable the use of common sysexts
This enables adding the common sysext to the entries to enable Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
parent
6dedbfcc50
commit
7525bfde75
@ -448,9 +448,9 @@ func (s *State) EnableSysExtensions(g *herd.Graph, opts ...herd.OpOption) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// If we wanted to use a common dir for extensions used for both entries, here we would do something like:
|
||||
// commonEntries, _ := os.ReadDir(s.path(fmt.Sprintf("%s/%s", cnst.SourceSysExtDir, "common")))
|
||||
// entries = append(entries, commonEntries...)
|
||||
// Common dir is always there for all states no matter what
|
||||
commonEntries, _ := os.ReadDir(s.path(fmt.Sprintf("%s/%s", cnst.SourceSysExtDir, "common")))
|
||||
entries = append(entries, commonEntries...)
|
||||
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() && filepath.Ext(entry.Name()) == ".raw" {
|
||||
@ -466,6 +466,14 @@ func (s *State) EnableSysExtensions(g *herd.Graph, opts ...herd.OpOption) error
|
||||
}
|
||||
}
|
||||
// it has to link to the final dir after initramfs, so we avoid setting s.path here for the target
|
||||
// Check if it already exists with the same name
|
||||
// This is because as we have the common dir, there could be a point in which the common dir and the
|
||||
// specific boot state dir have the same file, and we dont want to fail at this point, just warn and continue
|
||||
if _, err := os.Stat(filepath.Join(cnst.DestSysExtDir, entry.Name())); !os.IsNotExist(err) {
|
||||
// If it exists, we can just skip it
|
||||
internalUtils.Log.Warn().Str("file", filepath.Join(cnst.DestSysExtDir, entry.Name())).Msg("Skipping sysextension as its already enabled")
|
||||
continue
|
||||
}
|
||||
err = os.Symlink(filepath.Join(dir, entry.Name()), filepath.Join(cnst.DestSysExtDir, entry.Name()))
|
||||
if err != nil {
|
||||
internalUtils.Log.Err(err).Msg("Creating symlink")
|
||||
|
Loading…
Reference in New Issue
Block a user