Skip to content

Commit

Permalink
Only create ISO output
Browse files Browse the repository at this point in the history
  • Loading branch information
dgiebert committed Nov 22, 2024
1 parent b4f2836 commit ee58fd1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ go.work
# Don't upload test data
examples/*/base-images
examples/*/_build
examples/*/*.tar
examples/*/*.iso
2 changes: 1 addition & 1 deletion examples/combustion/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image:
arch: x86_64
imageType: combustion
baseImage: ""
outputImageName: combustion.tar
outputImageName: combustion.iso
operatingSystem:
time:
timezone: Europe/Berlin
Expand Down
4 changes: 1 addition & 3 deletions pkg/build/templates/create-combustion.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ mkdir -p {{ .CombustionTmpPath }}
cp -r {{ .CombustionDir }} {{ .CombustionTmpPath }}
cp -r {{ .ArtefactsDir }} {{ .CombustionTmpPath }}

mkisofs -J -o {{ .CombustionTmpPath }}/combustion.iso -V combustion {{ .CombustionTmpPath }}

tar -cvf {{.OutputImageFilename}} -C {{ .CombustionTmpPath }} .
mkisofs -J -o {{.OutputImageFilename}} -V COMBUSTION {{ .CombustionTmpPath }}
9 changes: 6 additions & 3 deletions pkg/combustion/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ echo "Running foo.sh"
`)
}

func TestAssembleScript_MountCombustion(t *testing.T) {
func TestAssembleScript_CombustionNoMount(t *testing.T) {
script, err := assembleScript([]string{""}, "", "combustion")
require.NoError(t, err)

assert.Contains(t, script, `
mount -o ro /dev/disk/by-label/combustion /mnt
assert.NotContains(t, script, `
mount -o ro /dev/disk/by-label/INSTALL /mnt
`)
assert.NotContains(t, script, `
umount / mnt
`)
}
func TestAssembleScript_MountISO(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions pkg/combustion/templates/script-base.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ exec > >(exec tee -a /dev/tty0) 2>&1
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1

{{ if eq .ImageType "combustion" -}}
mount -o ro /dev/disk/by-label/combustion /mnt
export ARTEFACTS_DIR=../artefacts
{{- else -}}
mount -o ro /dev/disk/by-label/INSTALL /mnt
{{- end }}
export ARTEFACTS_DIR=/mnt/artefacts
{{- end }}

{{ range .Scripts -}}
echo "Running {{ . }}"
./{{ . }}

{{ end -}}

{{ if ne .ImageType "combustion" -}}
umount /mnt
{{- end }}

0 comments on commit ee58fd1

Please sign in to comment.