Skip to content

Commit e17f1ee

Browse files
committed
Avoid attempting to re-create /init if it already exists
1 parent 71cb7be commit e17f1ee

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

toolkit/tools/pkg/imagecustomizerlib/liveosisoartifactstore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ func createIsoArtifactStoreFromMountedImage(inputArtifactsStore *IsoArtifactsSto
489489
}
490490

491491
func createIsoArtifactStoreFromIsoImage(isoImageFile, storeDir string) (artifactStore *IsoArtifactsStore, err error) {
492-
logger.Log.Infof("Creating ISO store (%s) from (%s)", storeDir, isoImageFile)
492+
logger.Log.Debugf("Creating ISO store (%s) from (%s)", storeDir, isoImageFile)
493493

494494
err = os.MkdirAll(storeDir, os.ModePerm)
495495
if err != nil {

toolkit/tools/pkg/imagecustomizerlib/liveosisoimages.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,16 @@ func createFullOSInitrdImage(writeableRootfsDir, outputInitrdPath string) error
7676
}
7777

7878
initKernelLocalPath := filepath.Join(writeableRootfsDir, initKernelInitrdPath)
79-
err = os.Symlink(initBinaryInitrdPath, initKernelLocalPath)
79+
80+
exists, err := file.PathExists(initKernelLocalPath)
8081
if err != nil {
81-
return fmt.Errorf("failed to create symlink (%s):\n%w", initKernelLocalPath, err)
82+
return fmt.Errorf("failed to check if (%s) exists:\n%w", initKernelLocalPath, err)
83+
}
84+
if !exists {
85+
err = os.Symlink(initBinaryInitrdPath, initKernelLocalPath)
86+
if err != nil {
87+
return fmt.Errorf("failed to create symlink (%s):\n%w", initKernelLocalPath, err)
88+
}
8289
}
8390

8491
err = initrdutils.CreateInitrdImageFromFolder(writeableRootfsDir, outputInitrdPath)
@@ -415,7 +422,7 @@ func createWriteableImageFromArtifacts(buildDir string, artifactsStore *IsoArtif
415422
}
416423
}
417424

418-
logger.Log.Infof("Populated (%s) with full file system", rootfsDir)
425+
logger.Log.Debugf("Populated (%s) with full file system", rootfsDir)
419426

420427
// boot folder (from artifacts)
421428
artifactsBootDir := filepath.Join(artifactsStore.files.artifactsDir, "boot")

0 commit comments

Comments
 (0)