Skip to content

Commit

Permalink
Merge pull request #882 from rick-gnous/main
Browse files Browse the repository at this point in the history
Add mkisofs support
  • Loading branch information
stgraber authored Oct 23, 2024
2 parents 31c87aa + e9c6e0f commit a28ea73
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions distrobuilder/main_repack-windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,22 @@ func (c *cmdRepackWindows) run(cmd *cobra.Command, args []string, overlayDir str

logger.Info("Generating new ISO")
var stdout strings.Builder
var software string

err = shared.RunCommand(c.global.ctx, nil, &stdout, "genisoimage", "--version")
if err != nil {
return fmt.Errorf("Failed to determine version of genisoimage: %w", err)
err = shared.RunCommand(c.global.ctx, nil, &stdout, "mkisofs", "--version")
if err != nil {
return fmt.Errorf("Failed to determine version of genisoimage or mkisofs: %w", err)
} else {
software = "mkisofs"
}
} else {
software = "genisoimage"
}

version := strings.Split(stdout.String(), "\n")[0]

genArgs := []string{"-l", "-iso-level", "4", "-no-emul-boot",
"-b", "boot/etfsboot.com", "-boot-load-seg", "0",
"-boot-load-size", "8", "-eltorito-alt-boot"}
Expand All @@ -337,7 +346,7 @@ func (c *cmdRepackWindows) run(cmd *cobra.Command, args []string, overlayDir str

return os.Stderr.Write(b)
})),
nil, nil, "genisoimage", genArgs...)
nil, nil, software, genArgs...)

if err != nil {
return fmt.Errorf("Failed to generate ISO: %w", err)
Expand Down Expand Up @@ -426,7 +435,7 @@ func (c *cmdRepackWindows) modifyWimIndex(wimFile string, index int, name string
}

func (c *cmdRepackWindows) checkDependencies() error {
dependencies := []string{"genisoimage", "hivexregedit", "rsync", "wimlib-imagex"}
dependencies := []string{"hivexregedit", "rsync", "wimlib-imagex"}

for _, dep := range dependencies {
_, err := exec.LookPath(dep)
Expand All @@ -435,6 +444,12 @@ func (c *cmdRepackWindows) checkDependencies() error {
}
}

_, err := exec.LookPath("genisoimage")
_, err1 := exec.LookPath("mkisofs")
if err != nil && err1 != nil {
return fmt.Errorf("Required tool genisoimage or mkisofs is missing")
}

return nil
}

Expand Down

0 comments on commit a28ea73

Please sign in to comment.