Skip to content

Commit be3cade

Browse files
committed
FIx: xorriso arguments
1 parent 492e0fd commit be3cade

8 files changed

Lines changed: 56 additions & 134 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package boot
2+
3+
import "path"
4+
5+
var xorrisoCommonArgs = &xorrisoArg{
6+
args: func(o *xorriso) []string {
7+
out := path.Join(o.out, "alterlinux.iso")
8+
return []string{
9+
"-no_rc",
10+
"-as", "mkisofs",
11+
"-iso-level", "3",
12+
"-full-iso9660-filenames",
13+
"-joliet",
14+
"-joliet-long",
15+
"-rational-rock",
16+
"--output", out,
17+
o.fsDir,
18+
}
19+
},
20+
}

alteriso5/cmd/build/work/boot/xorriso-syslinux.go

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,31 @@ import (
55
)
66

77
// SysLinux MBR El Torito
8-
func (o *xorriso) SetArgsForSysLinuxElTorito() {
9-
arg := xorrisoArg{
10-
name: "SysLinuxEltorito",
11-
bootMode: "SysLinux",
12-
}
13-
14-
arg.add("-eltorito-boot", "boot/syslinux/isolinux.bin")
15-
arg.add("-eltorito-catalog", "boot/syslinux/boot.cat")
16-
arg.add("-no-emul-boot", "-boot-load-size", "4", "-boot-info-table")
17-
18-
o.addArg(&arg)
8+
var xorrisoArgsForSysLinuxElTorito = &xorrisoArg{
9+
bootMode: "SysLinux",
10+
args: func(o *xorriso) []string {
11+
return []string{
12+
"-eltorito-boot", "boot/syslinux/isolinux.bin",
13+
"-eltorito-catalog", "boot/syslinux/boot.cat",
14+
"-no-emul-boot", "-boot-load-size", "4", "-boot-info-table",
15+
}
16+
},
1917
}
2018

21-
func (o *xorriso) SetArgsForSysLinuxMBRBios() {
22-
23-
arg := xorrisoArg{
24-
name: "SysLinuxMBRBios",
25-
bootMode: "SysLinux",
26-
}
27-
28-
arg.add("-isohybrid-mbr", path.Join(o.fsDir, "boot", "syslinux", "isohqpfx.bin"))
29-
arg.add("--mbr-force-bootable")
30-
arg.add("-partition_offset", "16")
31-
32-
o.addArg(&arg)
33-
19+
var xorrisoArgsForSysLinuxMBRBios = &xorrisoArg{
20+
bootMode: "SysLinux",
21+
args: func(o *xorriso) []string {
22+
return []string{
23+
"-isohybrid-mbr", path.Join(o.fsDir, "boot", "syslinux", "isohdpfx.bin"),
24+
"--mbr-force-bootable",
25+
"-partition_offset", "16",
26+
}
27+
},
3428
}
3529

3630
func init() {
37-
Xorriso.SetArgsForSysLinuxElTorito()
38-
Xorriso.SetArgsForSysLinuxMBRBios()
31+
Xorriso.addArgs(
32+
xorrisoArgsForSysLinuxElTorito,
33+
xorrisoArgsForSysLinuxMBRBios,
34+
)
3935
}

alteriso5/cmd/build/work/boot/xorriso.go

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"fmt"
55
"os"
66
"os/exec"
7-
"path"
8-
"slices"
97
)
108

119
var Xorriso = xorriso{}
@@ -17,66 +15,24 @@ type xorriso struct {
1715
}
1816

1917
type xorrisoArg struct {
20-
name string
2118
bootMode string
22-
args *[]string
19+
args func(o *xorriso) []string
2320
}
2421

25-
func (xa *xorrisoArg) add(args ...string) {
26-
if xa.args == nil {
27-
xa.args = &[]string{}
28-
}
29-
30-
arg := append(*(xa.args), args...)
31-
xa.args = &arg
32-
}
33-
34-
func (x *xorriso) hasArg(a *xorrisoArg) bool {
35-
for _, x := range x.args {
36-
if x.name == a.name {
37-
return true
38-
}
39-
}
40-
return false
41-
}
42-
43-
func (o *xorriso) addArg(arg *xorrisoArg) {
44-
if !o.hasArg(arg) {
45-
o.args = append(o.args, arg)
46-
}
22+
func (x *xorriso) addArgs(arg ...*xorrisoArg) {
23+
x.args = append(x.args, arg...)
4724
}
4825

49-
func (o *xorriso) preArgs() *xorrisoArg {
50-
51-
out := path.Join(o.out, "alterlinux.iso")
26+
func (x *xorriso) Args(bootmode ...string) *[]string {
27+
var args []string
5228

53-
d := []string{
54-
"-no_rc",
55-
"-as", "mkisofs",
56-
"-iso-level", "3",
57-
"-full-iso9660-filenames",
58-
"-joliet",
59-
"-joliet-long",
60-
"-rational-rock",
61-
"--output", out,
62-
o.fsDir,
63-
}
64-
return &xorrisoArg{
65-
name: "pre",
66-
args: &d,
67-
}
68-
}
29+
args = append(args, xorrisoCommonArgs.args(x)...)
6930

70-
func (x *xorriso) Args(bootmode ...string) *[]string {
71-
args := []string{}
72-
pre := x.preArgs()
73-
args = append(args, *pre.args...)
74-
for _, a := range x.args {
75-
if slices.Contains(bootmode, a.bootMode) {
76-
args = append(args, *a.args...)
31+
for _, arg := range x.args {
32+
if bootmode[0] == arg.bootMode {
33+
args = append(args, arg.args(x)...)
7734
}
7835
}
79-
8036
return &args
8137
}
8238

alteriso5/cmd/build/work/task-bootmodes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ var makeSysLinux = NewBuildTask("makeSysLinux", func(w Work) error {
5353
for _, k := range kernels {
5454
cpFiles = append(cpFiles, utils.CopyTask{
5555
Source: path.Join(w.GetDirs().Pacstrap, k.Linux),
56-
Dest: path.Join(dirs.Iso, "boot", path.Base(k.Linux)),
56+
Dest: path.Join(dirs.Iso, "boot", w.target.Arch, path.Base(k.Linux)),
5757
Perm: 0644,
5858
}, utils.CopyTask{
5959
Source: path.Join(w.GetDirs().Pacstrap, k.Initrd),
60-
Dest: path.Join(dirs.Iso, "boot", path.Base(k.Initrd)),
60+
Dest: path.Join(dirs.Iso, "boot", w.target.Arch, path.Base(k.Initrd)),
6161
Perm: 0644,
6262
})
6363
}

profile/syslinux/archiso_pxe-linux.cfg

Lines changed: 0 additions & 32 deletions
This file was deleted.

profile/syslinux/archiso_pxe.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

profile/syslinux/archiso_sys-linux.cfg

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@ Boot the Arch Linux install medium on BIOS.
44
It allows you to install Arch Linux or perform system maintenance.
55
ENDTEXT
66
MENU LABEL Arch Linux install medium (x86_64, BIOS)
7-
LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux
8-
INITRD /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img
7+
LINUX /boot/x86_64/vmlinuz-linux
8+
INITRD /boot/x86_64/initramfs-linux.img
99
APPEND archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID%
1010

11-
# Accessibility boot option
12-
LABEL arch64speech
13-
TEXT HELP
14-
Boot the Arch Linux install medium on BIOS with speakup screen reader.
15-
It allows you to install Arch Linux or perform system maintenance with speech feedback.
16-
ENDTEXT
17-
MENU LABEL Arch Linux install medium (x86_64, BIOS) with ^speech
18-
LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux
19-
INITRD /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img
20-
APPEND archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% accessibility=on

profile/syslinux/syslinux.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ DEFAULT select
22

33
LABEL select
44
COM32 whichsys.c32
5-
APPEND -pxe- pxe -sys- sys -iso- sys
6-
7-
LABEL pxe
8-
CONFIG archiso_pxe.cfg
5+
APPEND -sys- sys -iso- sys
96

107
LABEL sys
118
CONFIG archiso_sys.cfg

0 commit comments

Comments
 (0)