mirror of
https://github.com/kairos-io/immucore.git
synced 2025-05-06 07:07:48 +00:00
Enable the use of common sysexts (#462)
This commit is contained in:
parent
6dedbfcc50
commit
2d238e7014
@ -448,9 +448,9 @@ func (s *State) EnableSysExtensions(g *herd.Graph, opts ...herd.OpOption) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we wanted to use a common dir for extensions used for both entries, here we would do something like:
|
// Common dir is always there for all states no matter what
|
||||||
// commonEntries, _ := os.ReadDir(s.path(fmt.Sprintf("%s/%s", cnst.SourceSysExtDir, "common")))
|
commonEntries, _ := os.ReadDir(s.path(fmt.Sprintf("%s/%s", cnst.SourceSysExtDir, "common")))
|
||||||
// entries = append(entries, commonEntries...)
|
entries = append(entries, commonEntries...)
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if !entry.IsDir() && filepath.Ext(entry.Name()) == ".raw" {
|
if !entry.IsDir() && filepath.Ext(entry.Name()) == ".raw" {
|
||||||
@ -465,6 +465,14 @@ func (s *State) EnableSysExtensions(g *herd.Graph, opts ...herd.OpOption) error
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 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
|
||||||
|
}
|
||||||
// it has to link to the final dir after initramfs, so we avoid setting s.path here for the target
|
// it has to link to the final dir after initramfs, so we avoid setting s.path here for the target
|
||||||
err = os.Symlink(filepath.Join(dir, entry.Name()), filepath.Join(cnst.DestSysExtDir, entry.Name()))
|
err = os.Symlink(filepath.Join(dir, entry.Name()), filepath.Join(cnst.DestSysExtDir, entry.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user