From ee58fd1172a4ece1c582b6a383cb9002c98f57fd Mon Sep 17 00:00:00 2001 From: Dominic Giebert Date: Fri, 22 Nov 2024 10:11:25 +0100 Subject: [PATCH] Only create ISO output --- .gitignore | 1 - examples/combustion/basic.yaml | 2 +- pkg/build/templates/create-combustion.sh.tpl | 4 +--- pkg/combustion/script_test.go | 9 ++++++--- pkg/combustion/templates/script-base.sh.tpl | 6 ++++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index aef08004..8a072bfa 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,4 @@ go.work # Don't upload test data examples/*/base-images examples/*/_build -examples/*/*.tar examples/*/*.iso \ No newline at end of file diff --git a/examples/combustion/basic.yaml b/examples/combustion/basic.yaml index ce31c276..963ee2dc 100644 --- a/examples/combustion/basic.yaml +++ b/examples/combustion/basic.yaml @@ -3,7 +3,7 @@ image: arch: x86_64 imageType: combustion baseImage: "" - outputImageName: combustion.tar + outputImageName: combustion.iso operatingSystem: time: timezone: Europe/Berlin diff --git a/pkg/build/templates/create-combustion.sh.tpl b/pkg/build/templates/create-combustion.sh.tpl index 1f39048c..042d11d8 100644 --- a/pkg/build/templates/create-combustion.sh.tpl +++ b/pkg/build/templates/create-combustion.sh.tpl @@ -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 }} . \ No newline at end of file +mkisofs -J -o {{.OutputImageFilename}} -V COMBUSTION {{ .CombustionTmpPath }} \ No newline at end of file diff --git a/pkg/combustion/script_test.go b/pkg/combustion/script_test.go index e987e2f7..c1d46808 100644 --- a/pkg/combustion/script_test.go +++ b/pkg/combustion/script_test.go @@ -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) { diff --git a/pkg/combustion/templates/script-base.sh.tpl b/pkg/combustion/templates/script-base.sh.tpl index f31e9ae8..326cbb7b 100644 --- a/pkg/combustion/templates/script-base.sh.tpl +++ b/pkg/combustion/templates/script-base.sh.tpl @@ -18,11 +18,11 @@ 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 {{ . }}" @@ -30,4 +30,6 @@ echo "Running {{ . }}" {{ end -}} +{{ if ne .ImageType "combustion" -}} umount /mnt +{{- end }}