Skip to content

Commit 2452fa5

Browse files
committed
feat: Add RequireInjectable field to profile definition and update related scripts
1 parent 30eb0ad commit 2452fa5

4 files changed

Lines changed: 22 additions & 14 deletions

File tree

alteriso/configs/xfce/profiledef.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
],
1414
"kernel_name": "linux",
1515
"username": "live",
16-
"cow_spacesize": "1G"
16+
"cow_spacesize": "1G",
17+
"require_injectable": true
1718
}

alteriso/src/internal/archiso/injects/profiledef.sh.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ __alteriso_loadfile "$__alteriso_profile_dir/injecter.sh"
2222
__alteriso_validate
2323
__alteriso_validate_profile
2424

25+
{{ if .RequireInjectable -}}
26+
__alteriso_require_injectable
27+
{{- end }}
28+
2529
if [[ "$__alteriso_compatible_mode" = "y" ]]; then
2630
echo "[alteriso] INFO: Running in compatible mode. Injection features are disabled." >&2
2731
__alteriso_cleanup

alteriso/src/internal/archiso/profile_def.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,25 @@ func (p *Profile) ProfileDefSh() ([]byte, error) {
6161
}
6262
}
6363

64-
for fname, code := range p.Config.Injects {
65-
if _, ok := injects[fname]; !ok {
66-
injects[fname] = []string{}
67-
}
68-
injects[fname] = append(injects[fname], code...)
69-
}
64+
for fname, code := range p.Config.Injects {
65+
if _, ok := injects[fname]; !ok {
66+
injects[fname] = []string{}
67+
}
68+
injects[fname] = append(injects[fname], code...)
69+
}
7070

7171
s := struct {
7272
LoaderContent string
7373
ProfileDefContent string
7474
EmbedScripts []string
7575
Injects map[string][]string
76+
RequireInjectable bool
7677
}{
7778
LoaderContent: string(loaderContent),
7879
ProfileDefContent: string(profileDef),
7980
EmbedScripts: embedScripts,
8081
Injects: injects,
82+
RequireInjectable: p.Config.RequireInjectable,
8183
}
8284

8385
profileDefContent, err := profileDefTemplate()

alteriso/src/internal/archiso/profile_struct.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ type Profile struct {
99
}
1010

1111
type ProfileDef struct {
12-
Arch string `json:"arch"`
13-
Modules []string `json:"modules"`
14-
OSName string `json:"os_name"`
15-
KernelName string `json:"kernel_name"`
16-
UserName string `json:"username"`
17-
Injects map[string][]string `json:"injects"`
18-
COWSpaceSize string `json:"cow_spacesize"`
12+
Arch string `json:"arch"`
13+
Modules []string `json:"modules"`
14+
OSName string `json:"os_name"`
15+
KernelName string `json:"kernel_name"`
16+
UserName string `json:"username"`
17+
Injects map[string][]string `json:"injects"`
18+
COWSpaceSize string `json:"cow_spacesize"`
19+
RequireInjectable bool `json:"require_injectable"`
1920
}

0 commit comments

Comments
 (0)