Skip to content

Commit

Permalink
Merge pull request #577 from monstermunchkin/fixes/rhel
Browse files Browse the repository at this point in the history
sources: Fix RHEL common build directories
  • Loading branch information
stgraber authored Nov 4, 2021
2 parents c015943 + 05f057b commit be15ebc
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions sources/rhel-common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ type commonRHEL struct {
}

func (c *commonRHEL) unpackISO(filePath, rootfsDir string, scriptRunner func(string) error) error {
isoDir := filepath.Join(c.cacheDir, "iso")
squashfsDir := filepath.Join(c.cacheDir, "squashfs")
roRootDir := filepath.Join(c.cacheDir, "rootfs.ro")
tempRootDir := filepath.Join(c.cacheDir, "rootfs")
isoDir, err := ioutil.TempDir(c.cacheDir, "temp_")
if err != nil {
return fmt.Errorf("Failed to create temporary directory: %w", err)
}
defer os.RemoveAll(isoDir)

for _, dir := range []string{isoDir, squashfsDir, roRootDir} {
err := os.MkdirAll(dir, 0755)
if err != nil {
return fmt.Errorf("Failed to create directory %q: %w", dir, err)
}
squashfsDir, err := ioutil.TempDir(c.cacheDir, "temp_")
if err != nil {
return fmt.Errorf("Failed to create temporary directory: %w", err)
}
defer os.RemoveAll(squashfsDir)

tempRootDir, err := ioutil.TempDir(c.cacheDir, "temp_")
if err != nil {
return fmt.Errorf("Failed to create temporary directory: %w", err)
}
defer os.RemoveAll(tempRootDir)

// this is easier than doing the whole loop thing ourselves
err := shared.RunCommand("mount", "-o", "ro", filePath, isoDir)
err = shared.RunCommand("mount", "-o", "ro", filePath, isoDir)
if err != nil {
return fmt.Errorf("Failed to mount %q: %w", filePath, err)
}
Expand Down

0 comments on commit be15ebc

Please sign in to comment.