distro/rhel8: add tar image type for all architectures

This is a very minimal image type, which is not expected to do anything
with an empty blueprint. It is documented as a way to install RHEL for
Satellite.

This fixes #720.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-06-07 15:02:38 +02:00
parent 31f7bd9e74
commit 83a63aaf17
12 changed files with 22253 additions and 0 deletions

View file

@ -568,6 +568,14 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
return osbuild.NewQEMUAssembler(&options)
}
func tarAssembler(filename, compression string) *osbuild.Assembler {
return osbuild.NewTarAssembler(
&osbuild.TarAssemblerOptions{
Filename: filename,
Compression: compression,
})
}
// New creates a new distro object, defining the supported architectures and image types
func New() distro.Distro {
const GigaByte = 1024 * 1024 * 1024
@ -760,6 +768,21 @@ func New() distro.Distro {
},
}
tarImgType := imageType{
name: "tar",
filename: "root.tar.xz",
mimeType: "application/x-tar",
packages: []string{
"policycoreutils",
"selinux-policy-targeted",
},
bootable: false,
kernelOptions: "ro net.ifnames=0",
assembler: func(uefi bool, options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler {
return tarAssembler("root.tar.xz", "xz")
},
}
vhdImgType := imageType{
name: "vhd",
filename: "disk.vhd",
@ -860,6 +883,7 @@ func New() distro.Distro {
amiImgType,
qcow2ImageType,
openstackImgType,
tarImgType,
vhdImgType,
vmdkImgType,
)
@ -880,6 +904,7 @@ func New() distro.Distro {
amiImgType,
qcow2ImageType,
openstackImgType,
tarImgType,
)
ppc64le := architecture{
@ -900,12 +925,16 @@ func New() distro.Distro {
}
ppc64le.setImageTypes(
qcow2ImageType,
tarImgType,
)
s390x := architecture{
distro: &r,
name: "s390x",
}
s390x.setImageTypes(
tarImgType,
)
r.setArches(x8664, aarch64, ppc64le, s390x)

View file

@ -37,6 +37,13 @@ func TestFilenameFromType(t *testing.T) {
want: "disk.qcow2",
want1: "application/x-qemu-disk",
},
{
name: "tar",
args: args{"tar"},
want: "root.tar.xz",
want1: "application/x-tar",
},
{
name: "vhd",
args: args{"vhd"},
@ -134,6 +141,7 @@ func TestImageType_Name(t *testing.T) {
"ami",
"qcow2",
"openstack",
"tar",
"vhd",
"vmdk",
},
@ -144,13 +152,21 @@ func TestImageType_Name(t *testing.T) {
"ami",
"qcow2",
"openstack",
"tar",
},
},
{
arch: "ppc64le",
imgNames: []string{
"qcow2",
"tar",
},
},
{
arch: "s390x",
imgNames: []string{
"tar",
},
},
}
for _, mapping := range imgMap {