mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 16:29:18 +00:00
Only update ldcache if it exists
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
cd6fcb5297
commit
29c6288128
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
## v1.13.1
|
## v1.13.1
|
||||||
|
|
||||||
* Bump version to 1.13.1
|
* Update `update-ldcache` hook to only update ldcache if it exists.
|
||||||
|
* Update `update-ldcache` hook to create `/etc/ld.so.conf.d` folder if it doesn't exist.
|
||||||
|
|
||||||
## v1.13.0
|
## v1.13.0
|
||||||
|
|
||||||
|
@ -84,6 +84,12 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
|||||||
return fmt.Errorf("failed to determined container root: %v", err)
|
return fmt.Errorf("failed to determined container root: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = os.Stat(filepath.Join(containerRoot, "/etc/ld.so.cache"))
|
||||||
|
if err != nil && os.IsNotExist(err) {
|
||||||
|
m.logger.Debugf("No ld.so.cache found, skipping update")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
err = m.createConfig(containerRoot, cfg.folders.Value())
|
err = m.createConfig(containerRoot, cfg.folders.Value())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to update ld.so.conf: %v", err)
|
return fmt.Errorf("failed to update ld.so.conf: %v", err)
|
||||||
@ -105,6 +111,10 @@ func (m command) createConfig(root string, folders []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(filepath.Join(root, "/etc/ld.so.conf.d"), 0755); err != nil {
|
||||||
|
return fmt.Errorf("failed to create ld.so.conf.d: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "nvcr-*.conf")
|
configFile, err := os.CreateTemp(filepath.Join(root, "/etc/ld.so.conf.d"), "nvcr-*.conf")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create config file: %v", err)
|
return fmt.Errorf("failed to create config file: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user