Delete internal/blueprint/ and import from osbuild/blueprint
Import osbuild/blueprint v1.6.0
This commit is contained in:
parent
362712a71d
commit
cf956ff5a6
93 changed files with 2300 additions and 4163 deletions
1
vendor/github.com/osbuild/images/pkg/customizations/subscription/subscription.go
generated
vendored
1
vendor/github.com/osbuild/images/pkg/customizations/subscription/subscription.go
generated
vendored
|
|
@ -15,6 +15,7 @@ type ImageOptions struct {
|
|||
BaseUrl string `json:"base_url"`
|
||||
Insights bool `json:"insights"`
|
||||
Rhc bool `json:"rhc"`
|
||||
Proxy string `json:"proxy"`
|
||||
}
|
||||
|
||||
type RHSMStatus string
|
||||
|
|
|
|||
22
vendor/github.com/osbuild/images/pkg/disk/btrfs.go
generated
vendored
22
vendor/github.com/osbuild/images/pkg/disk/btrfs.go
generated
vendored
|
|
@ -11,10 +11,10 @@ import (
|
|||
const DefaultBtrfsCompression = "zstd:1"
|
||||
|
||||
type Btrfs struct {
|
||||
UUID string
|
||||
Label string
|
||||
Mountpoint string
|
||||
Subvolumes []BtrfsSubvolume
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
Label string `json:"label,omitempty" yaml:"label,omitempty"`
|
||||
Mountpoint string `json:"mountpoint,omitempty" yaml:"mountpoint,omitempty"`
|
||||
Subvolumes []BtrfsSubvolume `json:"subvolumes,omitempty" yaml:"subvolumes,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -107,15 +107,15 @@ func (b *Btrfs) minSize(size uint64) uint64 {
|
|||
}
|
||||
|
||||
type BtrfsSubvolume struct {
|
||||
Name string
|
||||
Size uint64
|
||||
Mountpoint string
|
||||
GroupID uint64
|
||||
Compress string
|
||||
ReadOnly bool
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Size uint64 `json:"size" yaml:"size"`
|
||||
Mountpoint string `json:"mountpoint,omitempty" yaml:"mountpoint,omitempty"`
|
||||
GroupID uint64 `json:"group_id,omitempty" yaml:"group_id,omitempty"`
|
||||
Compress string `json:"compress,omitempty" yaml:"compress,omitempty"`
|
||||
ReadOnly bool `json:"read_only,omitempty" yaml:"read_only,omitempty"`
|
||||
|
||||
// UUID of the parent volume
|
||||
UUID string
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
}
|
||||
|
||||
func (bs *BtrfsSubvolume) Clone() Entity {
|
||||
|
|
|
|||
8
vendor/github.com/osbuild/images/pkg/disk/disk.go
generated
vendored
8
vendor/github.com/osbuild/images/pkg/disk/disk.go
generated
vendored
|
|
@ -24,11 +24,11 @@ import (
|
|||
"io"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"slices"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/osbuild/images/pkg/arch"
|
||||
)
|
||||
|
||||
|
|
@ -248,6 +248,10 @@ func (t PartitionTableType) MarshalJSON() ([]byte, error) {
|
|||
return json.Marshal(t.String())
|
||||
}
|
||||
|
||||
func (t PartitionTableType) MarshalYAML() (interface{}, error) {
|
||||
return t.String(), nil
|
||||
}
|
||||
|
||||
func (t *PartitionTableType) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
|
|
|
|||
14
vendor/github.com/osbuild/images/pkg/disk/filesystem.go
generated
vendored
14
vendor/github.com/osbuild/images/pkg/disk/filesystem.go
generated
vendored
|
|
@ -9,19 +9,19 @@ import (
|
|||
|
||||
// Filesystem related functions
|
||||
type Filesystem struct {
|
||||
Type string `json:"type"`
|
||||
Type string `json:"type" yaml:"type"`
|
||||
|
||||
// ID of the filesystem, vfat doesn't use traditional UUIDs, therefore this
|
||||
// is just a string.
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Mountpoint string `json:"mountpoint,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
Label string `json:"label,omitempty" yaml:"label,omitempty"`
|
||||
Mountpoint string `json:"mountpoint,omitempty" yaml:"mountpoint,omitempty"`
|
||||
// The fourth field of fstab(5); fs_mntops
|
||||
FSTabOptions string `json:"fstab_options,omitempty"`
|
||||
FSTabOptions string `json:"fstab_options,omitempty" yaml:"fstab_options,omitempty"`
|
||||
// The fifth field of fstab(5); fs_freq
|
||||
FSTabFreq uint64 `json:"fstab_freq,omitempty"`
|
||||
FSTabFreq uint64 `json:"fstab_freq,omitempty" yaml:"fstab_freq,omitempty"`
|
||||
// The sixth field of fstab(5); fs_passno
|
||||
FSTabPassNo uint64 `json:"fstab_passno,omitempty"`
|
||||
FSTabPassNo uint64 `json:"fstab_passno,omitempty" yaml:"fstab_passno,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
52
vendor/github.com/osbuild/images/pkg/disk/luks.go
generated
vendored
52
vendor/github.com/osbuild/images/pkg/disk/luks.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
|
|
@ -13,41 +14,41 @@ import (
|
|||
// Argon2id defines parameters for the key derivation function for LUKS.
|
||||
type Argon2id struct {
|
||||
// Number of iterations to perform.
|
||||
Iterations uint
|
||||
Iterations uint `json:"iterations,omitempty" yaml:"iterations,omitempty"`
|
||||
|
||||
// Amount of memory to use (in KiB).
|
||||
Memory uint
|
||||
Memory uint `json:"memory,omitempty" yaml:"memory,omitempty"`
|
||||
|
||||
// Degree of parallelism (i.e. number of threads).
|
||||
Parallelism uint
|
||||
Parallelism uint `json:"parallelism,omitempty" yaml:"parallelism,omitempty"`
|
||||
}
|
||||
|
||||
// ClevisBind defines parameters for binding a LUKS device with a given policy.
|
||||
type ClevisBind struct {
|
||||
Pin string
|
||||
Policy string
|
||||
Pin string `json:"pin,omitempty" yaml:"pin,omitempty"`
|
||||
Policy string `json:"policy,omitempty" yaml:"policy,omitempty"`
|
||||
|
||||
// If enabled, the passphrase will be removed from the LUKS device at the
|
||||
// end of the build (using the org.osbuild.luks2.remove-key stage).
|
||||
RemovePassphrase bool
|
||||
RemovePassphrase bool `json:"remove_passphrase,omitempty" yaml:"remove_passphrase,omitempty"`
|
||||
}
|
||||
|
||||
// LUKSContainer represents a LUKS encrypted volume.
|
||||
type LUKSContainer struct {
|
||||
Passphrase string
|
||||
UUID string
|
||||
Cipher string
|
||||
Label string
|
||||
Subsystem string
|
||||
SectorSize uint64
|
||||
Passphrase string `json:"passphrase,omitempty" yaml:"passphrase,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
Cipher string `json:"cipher,omitempty" yaml:"cipher,omitempty"`
|
||||
Label string `json:"label,omitempty" yaml:"label,omitempty"`
|
||||
Subsystem string `json:"subsystem,omitempty" yaml:"subsystem,omitempty"`
|
||||
SectorSize uint64 `json:"sector_size,omitempty" yaml:"sector_size,omitempty"`
|
||||
|
||||
// The password-based key derivation function's parameters.
|
||||
PBKDF Argon2id
|
||||
PBKDF Argon2id `json:"pbkdf,omitempty" yaml:"pbkdf,omitempty"`
|
||||
|
||||
// Parameters for binding the LUKS device.
|
||||
Clevis *ClevisBind
|
||||
Clevis *ClevisBind `json:"clevis,omitempty" yaml:"clevis,omitempty"`
|
||||
|
||||
Payload Entity
|
||||
Payload Entity `json:"payload,omitempty" yaml:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -131,3 +132,24 @@ func (lc *LUKSContainer) minSize(size uint64) uint64 {
|
|||
}
|
||||
return minSize
|
||||
}
|
||||
|
||||
func (lc *LUKSContainer) UnmarshalJSON(data []byte) (err error) {
|
||||
// keep in sync with lvm.go,partition.go,luks.go
|
||||
type alias LUKSContainer
|
||||
var withoutPayload struct {
|
||||
alias
|
||||
Payload json.RawMessage `json:"payload" yaml:"payload"`
|
||||
PayloadType string `json:"payload_type" yaml:"payload_type"`
|
||||
}
|
||||
if err := jsonUnmarshalStrict(data, &withoutPayload); err != nil {
|
||||
return fmt.Errorf("cannot unmarshal %q: %w", data, err)
|
||||
}
|
||||
*lc = LUKSContainer(withoutPayload.alias)
|
||||
|
||||
lc.Payload, err = unmarshalJSONPayload(data)
|
||||
return err
|
||||
}
|
||||
|
||||
func (lc *LUKSContainer) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
return unmarshalYAMLviaJSON(lc, unmarshal)
|
||||
}
|
||||
|
|
|
|||
44
vendor/github.com/osbuild/images/pkg/disk/lvm.go
generated
vendored
44
vendor/github.com/osbuild/images/pkg/disk/lvm.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
@ -13,10 +14,10 @@ import (
|
|||
const LVMDefaultExtentSize = 4 * datasizes.MebiByte
|
||||
|
||||
type LVMVolumeGroup struct {
|
||||
Name string
|
||||
Description string
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
|
||||
LogicalVolumes []LVMLogicalVolume
|
||||
LogicalVolumes []LVMLogicalVolume `json:"logical_volumes,omitempty" yaml:"logical_volumes,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -174,10 +175,20 @@ func (vg *LVMVolumeGroup) minSize(size uint64) uint64 {
|
|||
return vg.AlignUp(size)
|
||||
}
|
||||
|
||||
func (vg *LVMVolumeGroup) UnmarshalJSON(data []byte) error {
|
||||
type alias LVMVolumeGroup
|
||||
var tmp alias
|
||||
if err := json.Unmarshal(data, &tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
*vg = LVMVolumeGroup(tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
type LVMLogicalVolume struct {
|
||||
Name string
|
||||
Size uint64
|
||||
Payload Entity
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Size uint64 `json:"size,omitempty" yaml:"size,omitempty"`
|
||||
Payload Entity `json:"payload,omitempty" yaml:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) Clone() Entity {
|
||||
|
|
@ -232,3 +243,24 @@ func lvname(path string) string {
|
|||
path = strings.TrimLeft(path, "/")
|
||||
return strings.ReplaceAll(path, "/", "_") + "lv"
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) UnmarshalJSON(data []byte) (err error) {
|
||||
// keep in sync with lvm.go,partition.go,luks.go
|
||||
type alias LVMLogicalVolume
|
||||
var withoutPayload struct {
|
||||
alias
|
||||
Payload json.RawMessage `json:"payload" yaml:"payload"`
|
||||
PayloadType string `json:"payload_type" yaml:"payload_type"`
|
||||
}
|
||||
if err := jsonUnmarshalStrict(data, &withoutPayload); err != nil {
|
||||
return fmt.Errorf("cannot unmarshal %q: %w", data, err)
|
||||
}
|
||||
*lv = LVMLogicalVolume(withoutPayload.alias)
|
||||
|
||||
lv.Payload, err = unmarshalJSONPayload(data)
|
||||
return err
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
return unmarshalYAMLviaJSON(lv, unmarshal)
|
||||
}
|
||||
|
|
|
|||
59
vendor/github.com/osbuild/images/pkg/disk/partition.go
generated
vendored
59
vendor/github.com/osbuild/images/pkg/disk/partition.go
generated
vendored
|
|
@ -1,28 +1,26 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type Partition struct {
|
||||
// Start of the partition in bytes
|
||||
Start uint64 `json:"start"`
|
||||
Start uint64 `json:"start,omitempty" yaml:"start,omitempty"`
|
||||
// Size of the partition in bytes
|
||||
Size uint64 `json:"size"`
|
||||
Size uint64 `json:"size" yaml:"size"`
|
||||
// Partition type, e.g. 0x83 for MBR or a UUID for gpt
|
||||
Type string `json:"type,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
// `Legacy BIOS bootable` (GPT) or `active` (DOS) flag
|
||||
Bootable bool `json:"bootable,omitempty"`
|
||||
Bootable bool `json:"bootable,omitempty" yaml:"bootable,omitempty"`
|
||||
|
||||
// ID of the partition, dos doesn't use traditional UUIDs, therefore this
|
||||
// is just a string.
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
|
||||
// If nil, the partition is raw; It doesn't contain a payload.
|
||||
Payload PayloadEntity `json:"payload,omitempty"`
|
||||
Payload PayloadEntity `json:"payload,omitempty" yaml:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (p *Partition) Clone() Entity {
|
||||
|
|
@ -105,14 +103,14 @@ func (p *Partition) IsPReP() bool {
|
|||
func (p *Partition) MarshalJSON() ([]byte, error) {
|
||||
type partAlias Partition
|
||||
|
||||
entityName := "no-payload"
|
||||
var entityName string
|
||||
if p.Payload != nil {
|
||||
entityName = p.Payload.EntityName()
|
||||
}
|
||||
|
||||
partWithPayloadType := struct {
|
||||
partAlias
|
||||
PayloadType string `json:"payload_type,omitempty"`
|
||||
PayloadType string `json:"payload_type,omitempty" yaml:"payload_type,omitempty"`
|
||||
}{
|
||||
partAlias(*p),
|
||||
entityName,
|
||||
|
|
@ -121,36 +119,23 @@ func (p *Partition) MarshalJSON() ([]byte, error) {
|
|||
return json.Marshal(partWithPayloadType)
|
||||
}
|
||||
|
||||
func (p *Partition) UnmarshalJSON(data []byte) error {
|
||||
type partAlias Partition
|
||||
var partWithoutPayload struct {
|
||||
partAlias
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
PayloadType string `json:"payload_type,omitempty"`
|
||||
func (p *Partition) UnmarshalJSON(data []byte) (err error) {
|
||||
// keep in sync with lvm.go,partition.go,luks.go
|
||||
type alias Partition
|
||||
var withoutPayload struct {
|
||||
alias
|
||||
Payload json.RawMessage `json:"payload" yaml:"payload"`
|
||||
PayloadType string `json:"payload_type" yaml:"payload_type"`
|
||||
}
|
||||
if err := jsonUnmarshalStrict(data, &withoutPayload); err != nil {
|
||||
return fmt.Errorf("cannot unmarshal %q: %w", data, err)
|
||||
}
|
||||
*p = Partition(withoutPayload.alias)
|
||||
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
if err := dec.Decode(&partWithoutPayload); err != nil {
|
||||
return fmt.Errorf("cannot build partition from %q: %w", data, err)
|
||||
}
|
||||
*p = Partition(partWithoutPayload.partAlias)
|
||||
// no payload, e.g. bios partiton
|
||||
if partWithoutPayload.PayloadType == "no-payload" {
|
||||
return nil
|
||||
}
|
||||
|
||||
entType := payloadEntityMap[partWithoutPayload.PayloadType]
|
||||
if entType == nil {
|
||||
return fmt.Errorf("cannot build partition from %q: unknown payload %q", data, partWithoutPayload.PayloadType)
|
||||
}
|
||||
entValP := reflect.New(entType).Elem().Addr()
|
||||
ent := entValP.Interface()
|
||||
if err := json.Unmarshal(partWithoutPayload.Payload, &ent); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Payload = ent.(PayloadEntity)
|
||||
return nil
|
||||
p.Payload, err = unmarshalJSONPayload(data)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *Partition) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
return unmarshalYAMLviaJSON(t, unmarshal)
|
||||
}
|
||||
|
|
|
|||
14
vendor/github.com/osbuild/images/pkg/disk/partition_table.go
generated
vendored
14
vendor/github.com/osbuild/images/pkg/disk/partition_table.go
generated
vendored
|
|
@ -15,19 +15,19 @@ import (
|
|||
|
||||
type PartitionTable struct {
|
||||
// Size of the disk (in bytes).
|
||||
Size uint64 `json:"size"`
|
||||
Size uint64 `json:"size,omitempty" yaml:"size,omitempty"`
|
||||
// Unique identifier of the partition table (GPT only).
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
// Partition table type, e.g. dos, gpt.
|
||||
Type PartitionTableType `json:"type"`
|
||||
Partitions []Partition `json:"partitions"`
|
||||
Type PartitionTableType `json:"type" yaml:"type"`
|
||||
Partitions []Partition `json:"partitions" yaml:"partitions"`
|
||||
|
||||
// Sector size in bytes
|
||||
SectorSize uint64 `json:"sector_size,omitempty"`
|
||||
SectorSize uint64 `json:"sector_size,omitempty" yaml:"sector_size,omitempty"`
|
||||
// Extra space at the end of the partition table (sectors)
|
||||
ExtraPadding uint64 `json:"extra_padding,omitempty"`
|
||||
ExtraPadding uint64 `json:"extra_padding,omitempty" yaml:"extra_padding,omitempty"`
|
||||
// Starting offset of the first partition in the table (Mb)
|
||||
StartOffset uint64 `json:"start_offset,omitempty"`
|
||||
StartOffset uint64 `json:"start_offset,omitempty" yaml:"start_offset,omitempty"`
|
||||
}
|
||||
|
||||
type PartitioningMode string
|
||||
|
|
|
|||
34
vendor/github.com/osbuild/images/pkg/disk/unmarshal.go
generated
vendored
34
vendor/github.com/osbuild/images/pkg/disk/unmarshal.go
generated
vendored
|
|
@ -1,8 +1,10 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// unmarshalYAMLviaJSON unmarshals via the JSON interface, this avoids code
|
||||
|
|
@ -22,3 +24,35 @@ func unmarshalYAMLviaJSON(u json.Unmarshaler, unmarshal func(any) error) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func unmarshalJSONPayload(data []byte) (PayloadEntity, error) {
|
||||
var payload struct {
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
PayloadType string `json:"payload_type,omitempty"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &payload); err != nil {
|
||||
return nil, fmt.Errorf("cannot peek payload: %w", err)
|
||||
}
|
||||
if payload.PayloadType == "" {
|
||||
if len(payload.Payload) > 0 {
|
||||
return nil, fmt.Errorf("cannot build payload: empty payload type but payload is: %q", payload.Payload)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
entType := payloadEntityMap[payload.PayloadType]
|
||||
if entType == nil {
|
||||
return nil, fmt.Errorf("cannot build payload from %q: unknown payload type %q", data, payload.PayloadType)
|
||||
}
|
||||
entValP := reflect.New(entType).Elem().Addr()
|
||||
ent := entValP.Interface()
|
||||
if err := jsonUnmarshalStrict(payload.Payload, &ent); err != nil {
|
||||
return nil, fmt.Errorf("cannot decode payload for %q: %w", data, err)
|
||||
}
|
||||
return ent.(PayloadEntity), nil
|
||||
}
|
||||
|
||||
func jsonUnmarshalStrict(data []byte, v any) error {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
dec.DisallowUnknownFields()
|
||||
return dec.Decode(&v)
|
||||
}
|
||||
|
|
|
|||
289
vendor/github.com/osbuild/images/pkg/distro/defs/fedora/distro.yaml
generated
vendored
289
vendor/github.com/osbuild/images/pkg/distro/defs/fedora/distro.yaml
generated
vendored
|
|
@ -12,23 +12,288 @@
|
|||
- "geolite2-country"
|
||||
- "plymouth"
|
||||
|
||||
partitioning:
|
||||
ids:
|
||||
- &prep_partition_dosid "41"
|
||||
- &filesystem_linux_dosid "83"
|
||||
- &fat16_bdosid "06"
|
||||
guids:
|
||||
- &bios_boot_partition_guid "21686148-6449-6E6F-744E-656564454649"
|
||||
- &efi_system_partition_guid "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
|
||||
- &filesystem_data_guid "0FC63DAF-8483-4772-8E79-3D69D8477DE4"
|
||||
- &xboot_ldr_partition_guid "BC13C2FF-59E6-4262-A352-B275FD6F7172"
|
||||
# static UUIDs for partitions and filesystems
|
||||
# NOTE(akoutsou): These are unnecessary and have stuck around since the
|
||||
# beginning where (I believe) the goal was to have predictable,
|
||||
# reproducible partition tables. They might be removed soon in favour of
|
||||
# proper, random UUIDs, with reproducibility being controlled by fixing
|
||||
# rng seeds.
|
||||
uuids:
|
||||
- &bios_boot_partition_uuid "FAC7F1FB-3E8D-4137-A512-961DE09A5549"
|
||||
- &root_partition_uuid "6264D520-3FB9-423F-8AB8-7A0A8E3D3562"
|
||||
- &data_partition_uuid "CB07C243-BC44-4717-853E-28852021225B"
|
||||
- &efi_system_partition_uuid "68B2905B-DF3E-4FB3-80FA-49D1E773AA33"
|
||||
- &efi_filesystem_uuid "7B77-95E7"
|
||||
|
||||
default_partition_tables: &default_partition_tables
|
||||
x86_64:
|
||||
uuid: "D209C89E-EA5E-4FBD-B161-B461CCE297E0"
|
||||
type: "gpt"
|
||||
partitions:
|
||||
- size: 1_048_576 # 1 MiB
|
||||
bootable: true
|
||||
type: *bios_boot_partition_guid
|
||||
uuid: *bios_boot_partition_uuid
|
||||
- &default_partition_table_part_efi
|
||||
size: 209_715_200 # 200 MiB
|
||||
type: *efi_system_partition_guid
|
||||
uuid: *efi_system_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: vfat
|
||||
uuid: *efi_filesystem_uuid
|
||||
mountpoint: "/boot/efi"
|
||||
label: "EFI-SYSTEM"
|
||||
fstab_options: "defaults,uid=0,gid=0,umask=077,shortname=winnt"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 2
|
||||
- &default_partition_table_part_boot
|
||||
size: 524_288_000 # 500 * MiB
|
||||
type: *filesystem_data_guid
|
||||
uuid: *data_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
- &default_partition_table_part_root
|
||||
size: 2_147_483_648 # 2 * datasizes.GibiByte,
|
||||
type: *filesystem_data_guid
|
||||
uuid: *root_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
label: "root"
|
||||
mountpoint: "/"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
aarch64: &default_partition_table_aarch64
|
||||
uuid: "D209C89E-EA5E-4FBD-B161-B461CCE297E0"
|
||||
type: "gpt"
|
||||
partitions:
|
||||
- *default_partition_table_part_efi
|
||||
- *default_partition_table_part_boot
|
||||
- *default_partition_table_part_root
|
||||
ppc64le:
|
||||
uuid: "0x14fc63d2"
|
||||
type: "dos"
|
||||
partitions:
|
||||
- size: 4_194_304 # 4 MiB
|
||||
bootable: true
|
||||
type: *prep_partition_dosid
|
||||
- &default_partition_table_part_boot_ppc64le
|
||||
size: 524_288_000 # 500 * MiB
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
- &default_partition_table_part_root_ppc64le
|
||||
size: 2_147_483_648 # 2 * datasizes.GibiByte,
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
mountpoint: "/"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
s390x:
|
||||
uuid: "0x14fc63d2"
|
||||
type: "dos"
|
||||
partitions:
|
||||
- *default_partition_table_part_boot_ppc64le
|
||||
- <<: *default_partition_table_part_root_ppc64le
|
||||
bootable: true
|
||||
riscv64: *default_partition_table_aarch64
|
||||
|
||||
minimal_raw_partition_tables: &minimal_raw_partition_tables
|
||||
x86_64:
|
||||
uuid: "D209C89E-EA5E-4FBD-B161-B461CCE297E0"
|
||||
type: "gpt"
|
||||
start_offset: 8_388_608 # 8 * datasizes.MebiByte
|
||||
partitions:
|
||||
- *default_partition_table_part_efi
|
||||
- &minimal_raw_partition_table_part_boot
|
||||
<<: *default_partition_table_part_boot
|
||||
size: 1_073_741_824 # 1 * datasizes.GibiByte,
|
||||
type: *xboot_ldr_partition_guid
|
||||
- &minimal_raw_partition_table_part_root
|
||||
<<: *default_partition_table_part_root
|
||||
aarch64: &minimal_raw_partition_table_aarch64
|
||||
uuid: "0xc1748067"
|
||||
type: "dos"
|
||||
start_offset: 8_388_608 # 8 * datasizes.MebiByte
|
||||
partitions:
|
||||
- <<: *default_partition_table_part_efi
|
||||
bootable: true
|
||||
type: *fat16_bdosid
|
||||
uuid: ""
|
||||
- <<: *minimal_raw_partition_table_part_boot
|
||||
type: *filesystem_linux_dosid
|
||||
uuid: ""
|
||||
- <<: *default_partition_table_part_root
|
||||
type: *filesystem_linux_dosid
|
||||
uuid: ""
|
||||
riscv64: *minimal_raw_partition_table_aarch64
|
||||
|
||||
iot_base_partition_tables: &iot_base_partition_tables
|
||||
x86_64:
|
||||
uuid: "D209C89E-EA5E-4FBD-B161-B461CCE297E0"
|
||||
type: "gpt"
|
||||
start_offset: 8_388_608 # 8 * datasizes.MebiByte
|
||||
partitions:
|
||||
- &iot_base_partition_table_part_efi
|
||||
size: 525_336_576 # 501 * datasizes.MebiByte
|
||||
type: *efi_system_partition_guid
|
||||
uuid: *efi_system_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: vfat
|
||||
uuid: *efi_filesystem_uuid
|
||||
mountpoint: "/boot/efi"
|
||||
label: "EFI-SYSTEM"
|
||||
fstab_options: "umask=0077,shortname=winnt"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 2
|
||||
- &iot_base_partition_table_part_boot
|
||||
size: 1_073_741_824 # 1 * datasizes.GibiByte,
|
||||
type: *filesystem_data_guid
|
||||
uuid: *data_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
label: "boot"
|
||||
mountpoint: "/boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 1
|
||||
fstab_passno: 2
|
||||
- &iot_base_partition_table_part_root
|
||||
size: 2_693_791_744 # 2569 * datasizes.MebiByte,
|
||||
type: *filesystem_data_guid
|
||||
uuid: *root_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
label: "root"
|
||||
mountpoint: "/"
|
||||
fstab_options: "defaults,ro"
|
||||
fstab_freq: 1
|
||||
fstab_passno: 1
|
||||
aarch64: &iot_base_partition_table_aarch64
|
||||
uuid: "0xc1748067"
|
||||
type: "dos"
|
||||
start_offset: 8_388_608 # 8 * datasizes.MebiByte
|
||||
partitions:
|
||||
- <<: *iot_base_partition_table_part_efi
|
||||
bootable: true
|
||||
type: *fat16_bdosid
|
||||
uuid: ""
|
||||
- <<: *iot_base_partition_table_part_boot
|
||||
type: *filesystem_linux_dosid
|
||||
uuid: ""
|
||||
- <<: *iot_base_partition_table_part_root
|
||||
type: *filesystem_linux_dosid
|
||||
uuid: ""
|
||||
|
||||
iot_simplified_installer_partition_tables: &iot_simplified_installer_partition_tables
|
||||
x86_64: &iot_simplified_installer_partition_tables_x86
|
||||
uuid: "D209C89E-EA5E-4FBD-B161-B461CCE297E0"
|
||||
type: "gpt"
|
||||
partitions:
|
||||
- *iot_base_partition_table_part_efi
|
||||
- size: 1_073_741_824 # 1 * datasizes.GibiByte,
|
||||
type: *xboot_ldr_partition_guid
|
||||
uuid: *data_partition_uuid
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
label: "boot"
|
||||
mountpoint: "/boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 1
|
||||
fstab_passno: 1
|
||||
- type: *filesystem_data_guid
|
||||
uuid: *root_partition_uuid
|
||||
payload_type: "luks"
|
||||
payload:
|
||||
label: "crypt_root"
|
||||
cipher: "cipher_null"
|
||||
passphrase: "osbuild"
|
||||
pbkdf:
|
||||
memory: 32
|
||||
iterations: 4
|
||||
parallelism: 1
|
||||
clevis:
|
||||
pin: "null"
|
||||
policy: "{}"
|
||||
remove_passphrase: true
|
||||
payload_type: "lvm"
|
||||
payload:
|
||||
name: "rootvg"
|
||||
description: "built with lvm2 and osbuild"
|
||||
logical_volumes:
|
||||
- size: 8_589_934_592 # 8 * datasizes.GibiByte,
|
||||
name: "rootlv"
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
label: "root"
|
||||
mountpoint: "/"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
aarch64:
|
||||
<<: *iot_simplified_installer_partition_tables_x86
|
||||
|
||||
image_config:
|
||||
default:
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-fedora-ds.xml"
|
||||
hostname: "localhost.localdomain"
|
||||
install_weak_deps: true
|
||||
locale: "C.UTF-8"
|
||||
machine_id_uninitialized: true
|
||||
timezone: "UTC"
|
||||
|
||||
image_types:
|
||||
qcow2: &qcow2
|
||||
partition_table:
|
||||
<<: *default_partition_tables
|
||||
package_sets:
|
||||
- *cloud_base_pkgset
|
||||
- include:
|
||||
- "qemu-guest-agent"
|
||||
- *cloud_base_pkgset
|
||||
- include:
|
||||
- "qemu-guest-agent"
|
||||
ami: *qcow2
|
||||
oci: *qcow2
|
||||
openstack: *qcow2
|
||||
|
||||
vhd:
|
||||
partition_table:
|
||||
<<: *default_partition_tables
|
||||
package_sets:
|
||||
- *cloud_base_pkgset
|
||||
- include:
|
||||
- "WALinuxAgent"
|
||||
|
||||
vmdk: &vmdk
|
||||
partition_table:
|
||||
<<: *default_partition_tables
|
||||
package_sets:
|
||||
- include:
|
||||
- "@Fedora Cloud Server"
|
||||
|
|
@ -172,6 +437,20 @@ image_types:
|
|||
|
||||
iot_container: *iot_commit
|
||||
|
||||
iot_raw_image:
|
||||
partition_table:
|
||||
<<: *iot_base_partition_tables
|
||||
partition_table_override:
|
||||
condition:
|
||||
version_greater_or_equal:
|
||||
"42":
|
||||
- partition_index: 2
|
||||
fstab_options: "defaults,ro"
|
||||
|
||||
iot_qcow2_image:
|
||||
partition_table:
|
||||
<<: *iot_base_partition_tables
|
||||
|
||||
iot_bootable_container:
|
||||
package_sets:
|
||||
- include:
|
||||
|
|
@ -573,6 +852,8 @@ image_types:
|
|||
- "fuse-libs"
|
||||
|
||||
minimal_raw: &minimal_raw
|
||||
partition_table:
|
||||
<<: *minimal_raw_partition_tables
|
||||
package_sets:
|
||||
- include:
|
||||
- "@core"
|
||||
|
|
@ -599,6 +880,8 @@ image_types:
|
|||
minimal_raw_zst: *minimal_raw
|
||||
|
||||
iot_simplified_installer:
|
||||
partition_table:
|
||||
<<: *iot_simplified_installer_partition_tables
|
||||
package_sets:
|
||||
- *installer_pkgset
|
||||
- include:
|
||||
|
|
|
|||
261
vendor/github.com/osbuild/images/pkg/distro/defs/loader.go
generated
vendored
261
vendor/github.com/osbuild/images/pkg/distro/defs/loader.go
generated
vendored
|
|
@ -3,6 +3,7 @@ package defs
|
|||
|
||||
import (
|
||||
"embed"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
|
|
@ -15,38 +16,140 @@ import (
|
|||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/osbuild/images/internal/common"
|
||||
"github.com/osbuild/images/pkg/disk"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/experimentalflags"
|
||||
"github.com/osbuild/images/pkg/rpmmd"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrImageTypeNotFound = errors.New("image type not found")
|
||||
ErrNoPartitionTableForImgType = errors.New("no partition table for image type")
|
||||
ErrNoPartitionTableForArch = errors.New("no partition table for arch")
|
||||
)
|
||||
|
||||
//go:embed */*.yaml
|
||||
var data embed.FS
|
||||
|
||||
var DataFS fs.FS = data
|
||||
|
||||
type toplevelYAML struct {
|
||||
ImageTypes map[string]imageType `yaml:"image_types"`
|
||||
Common map[string]any `yaml:".common,omitempty"`
|
||||
ImageConfig imageConfig `yaml:"image_config,omitempty"`
|
||||
ImageTypes map[string]imageType `yaml:"image_types"`
|
||||
Common map[string]any `yaml:".common,omitempty"`
|
||||
}
|
||||
|
||||
type imageConfig struct {
|
||||
Default *distro.ImageConfig `yaml:"default"`
|
||||
Condition *imageConfigConditions `yaml:"condition,omitempty"`
|
||||
}
|
||||
|
||||
type imageConfigConditions struct {
|
||||
DistroName map[string]*distro.ImageConfig `yaml:"distro_name,omitempty"`
|
||||
}
|
||||
|
||||
type imageType struct {
|
||||
PackageSets []packageSet `yaml:"package_sets"`
|
||||
// archStr->partitionTable
|
||||
PartitionTables map[string]*disk.PartitionTable `yaml:"partition_table"`
|
||||
// override specific aspects of the partition table
|
||||
PartitionTablesOverrides *partitionTablesOverrides `yaml:"partition_table_override"`
|
||||
}
|
||||
|
||||
type packageSet struct {
|
||||
Include []string `yaml:"include"`
|
||||
Exclude []string `yaml:"exclude"`
|
||||
Condition *conditions `yaml:"condition,omitempty"`
|
||||
Include []string `yaml:"include"`
|
||||
Exclude []string `yaml:"exclude"`
|
||||
Condition *pkgSetConditions `yaml:"condition,omitempty"`
|
||||
}
|
||||
|
||||
type conditions struct {
|
||||
type pkgSetConditions struct {
|
||||
Architecture map[string]packageSet `yaml:"architecture,omitempty"`
|
||||
VersionLessThan map[string]packageSet `yaml:"version_less_than,omitempty"`
|
||||
VersionGreaterOrEqual map[string]packageSet `yaml:"version_greater_or_equal,omitempty"`
|
||||
DistroName map[string]packageSet `yaml:"distro_name,omitempty"`
|
||||
}
|
||||
|
||||
type partitionTablesOverrides struct {
|
||||
Conditional *partitionTablesOverwriteConditional `yaml:"condition"`
|
||||
}
|
||||
|
||||
func (po *partitionTablesOverrides) Apply(it distro.ImageType, pt *disk.PartitionTable, replacements map[string]string) error {
|
||||
if po == nil {
|
||||
return nil
|
||||
}
|
||||
cond := po.Conditional
|
||||
_, distroVersion := splitDistroNameVer(it.Arch().Distro().Name())
|
||||
|
||||
for gteqVer, geOverrides := range cond.VersionGreaterOrEqual {
|
||||
if r, ok := replacements[gteqVer]; ok {
|
||||
gteqVer = r
|
||||
}
|
||||
if common.VersionGreaterThanOrEqual(distroVersion, gteqVer) {
|
||||
for _, overrideOp := range geOverrides {
|
||||
if err := overrideOp.Apply(pt); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type partitionTablesOverwriteConditional struct {
|
||||
VersionGreaterOrEqual map[string][]partitionTablesOverrideOp `yaml:"version_greater_or_equal,omitempty"`
|
||||
}
|
||||
|
||||
type partitionTablesOverrideOp struct {
|
||||
PartitionIndex int `yaml:"partition_index"`
|
||||
Size uint64 `yaml:"size"`
|
||||
FSTabOptions string `yaml:"fstab_options"`
|
||||
}
|
||||
|
||||
func (op *partitionTablesOverrideOp) Apply(pt *disk.PartitionTable) error {
|
||||
selectPart := op.PartitionIndex
|
||||
if selectPart > len(pt.Partitions) {
|
||||
return fmt.Errorf("override %q part %v outside of partitionTable %+v", op, selectPart, pt)
|
||||
}
|
||||
if op.Size > 0 {
|
||||
pt.Partitions[selectPart].Size = op.Size
|
||||
}
|
||||
if op.FSTabOptions != "" {
|
||||
part := pt.Partitions[selectPart]
|
||||
fs, ok := part.Payload.(*disk.Filesystem)
|
||||
if !ok {
|
||||
return fmt.Errorf("override %q part %v for fstab_options expecting filesystem got %T", op, selectPart, part)
|
||||
}
|
||||
fs.FSTabOptions = op.FSTabOptions
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DistroImageConfig returns the distro wide ImageConfig.
|
||||
//
|
||||
// Each ImageType gets this as their default ImageConfig.
|
||||
func DistroImageConfig(distroNameVer string) (*distro.ImageConfig, error) {
|
||||
toplevel, err := load(distroNameVer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
imgConfig := toplevel.ImageConfig.Default
|
||||
|
||||
cond := toplevel.ImageConfig.Condition
|
||||
if cond != nil {
|
||||
distroName, _ := splitDistroNameVer(distroNameVer)
|
||||
// XXX: we shoudl probably use a similar pattern like
|
||||
// for the partition table overrides (via
|
||||
// findElementIndexByJSONTag) but this if fine for now
|
||||
if distroNameCnf, ok := cond.DistroName[distroName]; ok {
|
||||
imgConfig = distroNameCnf.InheritFrom(imgConfig)
|
||||
}
|
||||
}
|
||||
|
||||
return imgConfig, nil
|
||||
}
|
||||
|
||||
// PackageSet loads the PackageSet from the yaml source file discovered via the
|
||||
// imagetype. By default the imagetype name is used to load the packageset
|
||||
// but with "overrideTypeName" this can be overriden (useful for e.g.
|
||||
|
|
@ -62,61 +165,18 @@ func PackageSet(it distro.ImageType, overrideTypeName string, replacements map[s
|
|||
archName := arch.Name()
|
||||
distribution := arch.Distro()
|
||||
distroNameVer := distribution.Name()
|
||||
// we need to split from the right for "centos-stream-10" like
|
||||
// distro names, sadly go has no rsplit() so we do it manually
|
||||
// XXX: we cannot use distroidparser here because of import cycles
|
||||
distroName := distroNameVer[:strings.LastIndex(distroNameVer, "-")]
|
||||
distroVersion := strings.SplitN(distroNameVer, "-", 2)[1]
|
||||
distroNameMajorVer := strings.SplitN(distroNameVer, ".", 2)[0]
|
||||
|
||||
// XXX: this is a short term measure, pass a set of
|
||||
// searchPaths down the stack instead
|
||||
var dataFS fs.FS = DataFS
|
||||
if overrideDir := experimentalflags.String("yamldir"); overrideDir != "" {
|
||||
logrus.Warnf("using experimental override dir %q", overrideDir)
|
||||
dataFS = os.DirFS(overrideDir)
|
||||
}
|
||||
|
||||
// XXX: this is only needed temporary until we have a "distros.yaml"
|
||||
// that describes some high-level properties of each distro
|
||||
// (like their yaml dirs)
|
||||
var baseDir string
|
||||
switch distroName {
|
||||
case "rhel":
|
||||
// rhel yaml files are under ./rhel-$majorVer
|
||||
baseDir = distroNameMajorVer
|
||||
case "centos":
|
||||
// centos yaml is just rhel but we have (sadly) no symlinks
|
||||
// in "go:embed" so we have to have this slightly ugly
|
||||
// workaround
|
||||
baseDir = fmt.Sprintf("rhel-%s", distroVersion)
|
||||
case "fedora", "test-distro":
|
||||
// our other distros just have a single yaml dir per distro
|
||||
// and use condition.version_gt etc
|
||||
baseDir = distroName
|
||||
default:
|
||||
return rpmmd.PackageSet{}, fmt.Errorf("unsupported distro in loader %q (add to loader.go)", distroName)
|
||||
}
|
||||
|
||||
f, err := dataFS.Open(filepath.Join(baseDir, "distro.yaml"))
|
||||
if err != nil {
|
||||
return rpmmd.PackageSet{}, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
decoder := yaml.NewDecoder(f)
|
||||
decoder.KnownFields(true)
|
||||
distroName, distroVersion := splitDistroNameVer(distroNameVer)
|
||||
|
||||
// each imagetype can have multiple package sets, so that we can
|
||||
// use yaml aliases/anchors to de-duplicate them
|
||||
var toplevel toplevelYAML
|
||||
if err := decoder.Decode(&toplevel); err != nil {
|
||||
toplevel, err := load(distroNameVer)
|
||||
if err != nil {
|
||||
return rpmmd.PackageSet{}, err
|
||||
}
|
||||
|
||||
imgType, ok := toplevel.ImageTypes[typeName]
|
||||
if !ok {
|
||||
return rpmmd.PackageSet{}, fmt.Errorf("unknown image type name %q", typeName)
|
||||
return rpmmd.PackageSet{}, fmt.Errorf("%w: %q", ErrImageTypeNotFound, typeName)
|
||||
}
|
||||
|
||||
var rpmmdPkgSet rpmmd.PackageSet
|
||||
|
|
@ -172,3 +232,98 @@ func PackageSet(it distro.ImageType, overrideTypeName string, replacements map[s
|
|||
|
||||
return rpmmdPkgSet, nil
|
||||
}
|
||||
|
||||
// PartitionTable returns the partionTable for the given distro/imgType.
|
||||
func PartitionTable(it distro.ImageType, replacements map[string]string) (*disk.PartitionTable, error) {
|
||||
distroNameVer := it.Arch().Distro().Name()
|
||||
typeName := strings.ReplaceAll(it.Name(), "-", "_")
|
||||
|
||||
toplevel, err := load(distroNameVer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imgType, ok := toplevel.ImageTypes[typeName]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: %q", ErrImageTypeNotFound, typeName)
|
||||
}
|
||||
if imgType.PartitionTables == nil {
|
||||
return nil, fmt.Errorf("%w: %q", ErrNoPartitionTableForImgType, typeName)
|
||||
}
|
||||
arch := it.Arch()
|
||||
archName := arch.Name()
|
||||
|
||||
pt, ok := imgType.PartitionTables[archName]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w (%q): %q", ErrNoPartitionTableForArch, typeName, archName)
|
||||
}
|
||||
|
||||
if err := imgType.PartitionTablesOverrides.Apply(it, pt, replacements); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return pt, nil
|
||||
}
|
||||
|
||||
func splitDistroNameVer(distroNameVer string) (string, string) {
|
||||
// we need to split from the right for "centos-stream-10" like
|
||||
// distro names, sadly go has no rsplit() so we do it manually
|
||||
// XXX: we cannot use distroidparser here because of import cycles
|
||||
idx := strings.LastIndex(distroNameVer, "-")
|
||||
return distroNameVer[:idx], distroNameVer[idx+1:]
|
||||
}
|
||||
|
||||
func load(distroNameVer string) (*toplevelYAML, error) {
|
||||
// we need to split from the right for "centos-stream-10" like
|
||||
// distro names, sadly go has no rsplit() so we do it manually
|
||||
// XXX: we cannot use distroidparser here because of import cycles
|
||||
distroName, distroVersion := splitDistroNameVer(distroNameVer)
|
||||
distroNameMajorVer := strings.SplitN(distroNameVer, ".", 2)[0]
|
||||
|
||||
// XXX: this is a short term measure, pass a set of
|
||||
// searchPaths down the stack instead
|
||||
var dataFS fs.FS = DataFS
|
||||
if overrideDir := experimentalflags.String("yamldir"); overrideDir != "" {
|
||||
logrus.Warnf("using experimental override dir %q", overrideDir)
|
||||
dataFS = os.DirFS(overrideDir)
|
||||
}
|
||||
|
||||
// XXX: this is only needed temporary until we have a "distros.yaml"
|
||||
// that describes some high-level properties of each distro
|
||||
// (like their yaml dirs)
|
||||
var baseDir string
|
||||
switch distroName {
|
||||
case "rhel":
|
||||
// rhel yaml files are under ./rhel-$majorVer
|
||||
baseDir = distroNameMajorVer
|
||||
case "centos":
|
||||
// centos yaml is just rhel but we have (sadly) no symlinks
|
||||
// in "go:embed" so we have to have this slightly ugly
|
||||
// workaround
|
||||
baseDir = fmt.Sprintf("rhel-%s", distroVersion)
|
||||
case "fedora", "test-distro":
|
||||
// our other distros just have a single yaml dir per distro
|
||||
// and use condition.version_gt etc
|
||||
baseDir = distroName
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported distro in loader %q (add to loader.go)", distroName)
|
||||
}
|
||||
|
||||
f, err := dataFS.Open(filepath.Join(baseDir, "distro.yaml"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
decoder := yaml.NewDecoder(f)
|
||||
decoder.KnownFields(true)
|
||||
|
||||
// each imagetype can have multiple package sets, so that we can
|
||||
// use yaml aliases/anchors to de-duplicate them
|
||||
var toplevel toplevelYAML
|
||||
if err := decoder.Decode(&toplevel); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &toplevel, nil
|
||||
}
|
||||
|
|
|
|||
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-10/distro.yaml
generated
vendored
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-10/distro.yaml
generated
vendored
|
|
@ -152,6 +152,23 @@
|
|||
- "grub2-efi-aa64"
|
||||
- "shim-aa64"
|
||||
|
||||
image_config:
|
||||
default:
|
||||
default_kernel: "kernel"
|
||||
# XXX: this needs to be conditional for centos and rhel
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml"
|
||||
install_weak_deps: true
|
||||
locale: "C.UTF-8"
|
||||
sysconfig:
|
||||
networking: true
|
||||
no_zero_conf: true
|
||||
timezone: "UTC"
|
||||
update_default_kernel: true
|
||||
condition:
|
||||
distro_name:
|
||||
centos:
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-cs10-ds.xml"
|
||||
|
||||
image_types:
|
||||
# XXX: not a real pkgset but the "os" pipeline pkgset for image-installer
|
||||
# find a nicer way to represent this
|
||||
|
|
|
|||
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-7/distro.yaml
generated
vendored
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-7/distro.yaml
generated
vendored
|
|
@ -44,6 +44,23 @@
|
|||
include:
|
||||
- "insights-client"
|
||||
|
||||
image_config:
|
||||
default:
|
||||
timezone: "America/New_York"
|
||||
locale: "en_US.UTF-8"
|
||||
gpgkey_files:
|
||||
- "/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
|
||||
sysconfig:
|
||||
networking: true
|
||||
no_zero_conf: true
|
||||
create_default_network_scripts: true
|
||||
default_kernel: "kernel"
|
||||
update_default_kernel: true
|
||||
kernel_options_bootloader: true
|
||||
# RHEL 7 grub does not support BLS
|
||||
no_bls: true
|
||||
install_weak_deps: true
|
||||
|
||||
image_types:
|
||||
azure_rhui:
|
||||
package_sets:
|
||||
|
|
|
|||
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-8/distro.yaml
generated
vendored
17
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-8/distro.yaml
generated
vendored
|
|
@ -524,6 +524,23 @@
|
|||
- "insights-client"
|
||||
- "subscription-manager-cockpit"
|
||||
|
||||
image_config:
|
||||
default:
|
||||
default_kernel: "kernel"
|
||||
# XXX: this needs to be conditional for centos and rhel
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml"
|
||||
install_weak_deps: true
|
||||
kernel_options_bootloader: true
|
||||
locale: "en_US.UTF-8"
|
||||
sysconfig:
|
||||
networking: true
|
||||
no_zero_conf: true
|
||||
timezone: "America/New_York"
|
||||
update_default_kernel: true
|
||||
condition:
|
||||
distro_name:
|
||||
centos:
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-centos8-ds.xml"
|
||||
|
||||
image_types:
|
||||
# XXX: not a real pkgset but the "os" pipeline pkgset for image-installer
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-9/distro.yaml
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/defs/rhel-9/distro.yaml
generated
vendored
|
|
@ -362,6 +362,22 @@
|
|||
include:
|
||||
- "dmidecode"
|
||||
|
||||
image_config:
|
||||
default:
|
||||
default_kernel: "kernel"
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml"
|
||||
install_weak_deps: true
|
||||
locale: "C.UTF-8"
|
||||
sysconfig:
|
||||
networking: true
|
||||
no_zero_conf: true
|
||||
timezone: "America/New_York"
|
||||
update_default_kernel: true
|
||||
condition:
|
||||
distro_name:
|
||||
centos:
|
||||
default_oscap_datastream: "/usr/share/xml/scap/ssg/content/ssg-cs9-ds.xml"
|
||||
|
||||
image_types:
|
||||
# XXX: not a real pkgset but the "os" pipeline pkgset for image-installer
|
||||
# find a nicer way to represent this
|
||||
|
|
|
|||
4
vendor/github.com/osbuild/images/pkg/distro/distro.go
generated
vendored
4
vendor/github.com/osbuild/images/pkg/distro/distro.go
generated
vendored
|
|
@ -102,6 +102,10 @@ type ImageType interface {
|
|||
// has no partition table. Only support for RHEL 8.5+
|
||||
PartitionType() disk.PartitionTableType
|
||||
|
||||
// Return the base partition tabe for the given image type, will
|
||||
// return `nil` if there is none
|
||||
BasePartitionTable() (*disk.PartitionTable, error)
|
||||
|
||||
// Returns the corresponding boot mode ("legacy", "uefi", "hybrid") or "none"
|
||||
BootMode() platform.BootMode
|
||||
|
||||
|
|
|
|||
44
vendor/github.com/osbuild/images/pkg/distro/fedora/distro.go
generated
vendored
44
vendor/github.com/osbuild/images/pkg/distro/fedora/distro.go
generated
vendored
|
|
@ -242,7 +242,6 @@ func mkIotSimplifiedInstallerImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-deployment", "image", "xz", "coi-tree", "efiboot-tree", "bootiso-tree", "bootiso"},
|
||||
exports: []string{"bootiso"},
|
||||
basePartitionTables: iotSimplifiedInstallerPartitionTables,
|
||||
kernelOptions: ostreeDeploymentKernelOptions(),
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
|
|
@ -265,15 +264,14 @@ func mkIotRawImgType(d distribution) imageType {
|
|||
LockRootUser: common.ToPtr(true),
|
||||
IgnitionPlatform: common.ToPtr("metal"),
|
||||
},
|
||||
defaultSize: 4 * datasizes.GibiByte,
|
||||
rpmOstree: true,
|
||||
bootable: true,
|
||||
image: iotImage,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-deployment", "image", "xz"},
|
||||
exports: []string{"xz"},
|
||||
basePartitionTables: iotBasePartitionTables,
|
||||
kernelOptions: ostreeDeploymentKernelOptions(),
|
||||
defaultSize: 4 * datasizes.GibiByte,
|
||||
rpmOstree: true,
|
||||
bootable: true,
|
||||
image: iotImage,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-deployment", "image", "xz"},
|
||||
exports: []string{"xz"},
|
||||
kernelOptions: ostreeDeploymentKernelOptions(),
|
||||
|
||||
// Passing an empty map into the required partition sizes disables the
|
||||
// default partition sizes normally set so our `basePartitionTables` can
|
||||
|
|
@ -304,7 +302,6 @@ func mkIotQcow2ImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-deployment", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: iotBasePartitionTables,
|
||||
kernelOptions: ostreeDeploymentKernelOptions(),
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
|
|
@ -329,7 +326,6 @@ func mkQcow2ImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
}
|
||||
|
|
@ -362,7 +358,6 @@ func mkVmdkImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vmdk"},
|
||||
exports: []string{"vmdk"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
}
|
||||
|
|
@ -383,7 +378,6 @@ func mkOvaImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vmdk", "ovf", "archive"},
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
}
|
||||
|
|
@ -438,10 +432,8 @@ func mkWslImgType(d distribution) imageType {
|
|||
ExcludeDocs: common.ToPtr(true),
|
||||
Locale: common.ToPtr("C.UTF-8"),
|
||||
Timezone: common.ToPtr("Etc/UTC"),
|
||||
WSLConfig: &osbuild.WSLConfStageOptions{
|
||||
Boot: osbuild.WSLConfBootOptions{
|
||||
Systemd: true,
|
||||
},
|
||||
WSLConfig: &distro.WSLConfig{
|
||||
BootSystemd: true,
|
||||
},
|
||||
},
|
||||
image: containerImage,
|
||||
|
|
@ -481,7 +473,6 @@ func mkMinimalRawImgType(d distribution) imageType {
|
|||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "xz"},
|
||||
exports: []string{"xz"},
|
||||
basePartitionTables: minimalrawPartitionTables,
|
||||
requiredPartitionSizes: requiredDirectorySizes,
|
||||
}
|
||||
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
|
||||
|
|
@ -508,16 +499,6 @@ type distribution struct {
|
|||
defaultImageConfig *distro.ImageConfig
|
||||
}
|
||||
|
||||
// Fedora based OS image configuration defaults
|
||||
var defaultDistroImageConfig = &distro.ImageConfig{
|
||||
Hostname: common.ToPtr("localhost.localdomain"),
|
||||
Timezone: common.ToPtr("UTC"),
|
||||
Locale: common.ToPtr("C.UTF-8"),
|
||||
DefaultOSCAPDatastream: common.ToPtr(oscap.DefaultFedoraDatastream()),
|
||||
InstallWeakDeps: common.ToPtr(true),
|
||||
MachineIdUninitialized: common.ToPtr(true),
|
||||
}
|
||||
|
||||
func defaultDistroInstallerConfig(d *distribution) *distro.InstallerConfig {
|
||||
config := distro.InstallerConfig{}
|
||||
// In Fedora 42 the ifcfg module was replaced by net-lib.
|
||||
|
|
@ -543,15 +524,16 @@ func getDistro(version int) distribution {
|
|||
if version < 0 {
|
||||
panic("Invalid Fedora version (must be positive)")
|
||||
}
|
||||
nameVer := fmt.Sprintf("fedora-%d", version)
|
||||
return distribution{
|
||||
name: fmt.Sprintf("fedora-%d", version),
|
||||
name: nameVer,
|
||||
product: "Fedora",
|
||||
osVersion: strconv.Itoa(version),
|
||||
releaseVersion: strconv.Itoa(version),
|
||||
modulePlatformID: fmt.Sprintf("platform:f%d", version),
|
||||
ostreeRefTmpl: fmt.Sprintf("fedora/%d/%%s/iot", version),
|
||||
runner: &runner.Fedora{Version: uint64(version)},
|
||||
defaultImageConfig: defaultDistroImageConfig,
|
||||
defaultImageConfig: common.Must(defs.DistroImageConfig(nameVer)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
4
vendor/github.com/osbuild/images/pkg/distro/fedora/images.go
generated
vendored
4
vendor/github.com/osbuild/images/pkg/distro/fedora/images.go
generated
vendored
|
|
@ -210,7 +210,7 @@ func osCustomizations(
|
|||
osc.ShellInit = imageConfig.ShellInit
|
||||
|
||||
osc.Grub2Config = imageConfig.Grub2Config
|
||||
osc.Sysconfig = imageConfig.Sysconfig
|
||||
osc.Sysconfig = imageConfig.SysconfigStageOptions()
|
||||
osc.SystemdLogind = imageConfig.SystemdLogind
|
||||
osc.CloudInit = imageConfig.CloudInit
|
||||
osc.Modprobe = imageConfig.Modprobe
|
||||
|
|
@ -226,7 +226,7 @@ func osCustomizations(
|
|||
osc.SshdConfig = imageConfig.SshdConfig
|
||||
osc.AuthConfig = imageConfig.Authconfig
|
||||
osc.PwQuality = imageConfig.PwQuality
|
||||
osc.WSLConfig = imageConfig.WSLConfig
|
||||
osc.WSLConfig = imageConfig.WSLConfStageOptions()
|
||||
|
||||
osc.Files = append(osc.Files, imageConfig.Files...)
|
||||
osc.Directories = append(osc.Directories, imageConfig.Directories...)
|
||||
|
|
|
|||
25
vendor/github.com/osbuild/images/pkg/distro/fedora/imagetype.go
generated
vendored
25
vendor/github.com/osbuild/images/pkg/distro/fedora/imagetype.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package fedora
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
|
|
@ -16,6 +17,7 @@ import (
|
|||
"github.com/osbuild/images/pkg/datasizes"
|
||||
"github.com/osbuild/images/pkg/disk"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/defs"
|
||||
"github.com/osbuild/images/pkg/experimentalflags"
|
||||
"github.com/osbuild/images/pkg/image"
|
||||
"github.com/osbuild/images/pkg/manifest"
|
||||
|
|
@ -56,9 +58,7 @@ type imageType struct {
|
|||
// rpmOstree: iot/ostree
|
||||
rpmOstree bool
|
||||
// bootable image
|
||||
bootable bool
|
||||
// List of valid arches for the image type
|
||||
basePartitionTables distro.BasePartitionTableMap
|
||||
bootable bool
|
||||
requiredPartitionSizes map[string]uint64
|
||||
}
|
||||
|
||||
|
|
@ -139,14 +139,18 @@ func (t *imageType) BootMode() platform.BootMode {
|
|||
return platform.BOOT_NONE
|
||||
}
|
||||
|
||||
func (t *imageType) BasePartitionTable() (*disk.PartitionTable, error) {
|
||||
return defs.PartitionTable(t, VersionReplacements())
|
||||
}
|
||||
|
||||
func (t *imageType) getPartitionTable(
|
||||
customizations *blueprint.Customizations,
|
||||
options distro.ImageOptions,
|
||||
rng *rand.Rand,
|
||||
) (*disk.PartitionTable, error) {
|
||||
basePartitionTable, exists := t.basePartitionTables[t.arch.Name()]
|
||||
if !exists {
|
||||
return nil, fmt.Errorf("unknown arch for partition table: %s", t.arch.Name())
|
||||
basePartitionTable, err := t.BasePartitionTable()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imageSize := t.Size(options.Size)
|
||||
|
|
@ -185,7 +189,7 @@ func (t *imageType) getPartitionTable(
|
|||
}
|
||||
|
||||
mountpoints := customizations.GetFilesystems()
|
||||
return disk.NewPartitionTable(&basePartitionTable, mountpoints, imageSize, partitioningMode, t.platform.GetArch(), t.requiredPartitionSizes, rng)
|
||||
return disk.NewPartitionTable(basePartitionTable, mountpoints, imageSize, partitioningMode, t.platform.GetArch(), t.requiredPartitionSizes, rng)
|
||||
}
|
||||
|
||||
func (t *imageType) getDefaultImageConfig() *distro.ImageConfig {
|
||||
|
|
@ -207,10 +211,13 @@ func (t *imageType) getDefaultInstallerConfig() (*distro.InstallerConfig, error)
|
|||
}
|
||||
|
||||
func (t *imageType) PartitionType() disk.PartitionTableType {
|
||||
basePartitionTable, exists := t.basePartitionTables[t.arch.Name()]
|
||||
if !exists {
|
||||
basePartitionTable, err := t.BasePartitionTable()
|
||||
if errors.Is(err, defs.ErrNoPartitionTableForImgType) {
|
||||
return disk.PT_NONE
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return basePartitionTable.Type
|
||||
}
|
||||
|
|
|
|||
594
vendor/github.com/osbuild/images/pkg/distro/fedora/partition_tables.go
generated
vendored
594
vendor/github.com/osbuild/images/pkg/distro/fedora/partition_tables.go
generated
vendored
|
|
@ -1,594 +0,0 @@
|
|||
package fedora
|
||||
|
||||
import (
|
||||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/datasizes"
|
||||
"github.com/osbuild/images/pkg/disk"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
)
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
arch.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 1 * datasizes.MebiByte,
|
||||
Bootable: true,
|
||||
Type: disk.BIOSBootPartitionGUID,
|
||||
UUID: disk.BIOSBootPartitionUUID,
|
||||
},
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 500 * datasizes.MebiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 500 * datasizes.MebiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_PPC64LE.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: disk.PT_DOS,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 4 * datasizes.MebiByte,
|
||||
Type: disk.PRepPartitionDOSID,
|
||||
Bootable: true,
|
||||
},
|
||||
{
|
||||
Size: 500 * datasizes.MebiByte,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
arch.ARCH_S390X.String(): disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: disk.PT_DOS,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 500 * datasizes.MebiByte,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Bootable: true,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_RISCV64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 500 * datasizes.MebiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var minimalrawPartitionTables = distro.BasePartitionTableMap{
|
||||
arch.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
StartOffset: 8 * datasizes.MebiByte,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.XBootLDRPartitionGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "0xc1748067",
|
||||
Type: disk.PT_DOS,
|
||||
StartOffset: 8 * datasizes.MebiByte,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.FAT16BDOSID,
|
||||
Bootable: true,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_RISCV64.String(): disk.PartitionTable{
|
||||
UUID: "0xc1748067",
|
||||
Type: disk.PT_DOS,
|
||||
StartOffset: 8 * datasizes.MebiByte,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 200 * datasizes.MebiByte,
|
||||
Type: disk.FAT16BDOSID,
|
||||
Bootable: true,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var iotBasePartitionTables = distro.BasePartitionTableMap{
|
||||
arch.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
StartOffset: 8 * datasizes.MebiByte,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 501 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "umask=0077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2569 * datasizes.MebiByte,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults,ro",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "0xc1748067",
|
||||
Type: disk.PT_DOS,
|
||||
StartOffset: 8 * datasizes.MebiByte,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 501 * datasizes.MebiByte,
|
||||
Type: disk.FAT16BDOSID,
|
||||
Bootable: true,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "umask=0077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 2569 * datasizes.MebiByte,
|
||||
Type: disk.FilesystemLinuxDOSID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults,ro",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var iotSimplifiedInstallerPartitionTables = distro.BasePartitionTableMap{
|
||||
arch.ARCH_X86_64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 501 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "umask=0077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.XBootLDRPartitionGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.LUKSContainer{
|
||||
Label: "crypt_root",
|
||||
Cipher: "cipher_null",
|
||||
Passphrase: "osbuild",
|
||||
PBKDF: disk.Argon2id{
|
||||
Memory: 32,
|
||||
Iterations: 4,
|
||||
Parallelism: 1,
|
||||
},
|
||||
Clevis: &disk.ClevisBind{
|
||||
Pin: "null",
|
||||
Policy: "{}",
|
||||
RemovePassphrase: true,
|
||||
},
|
||||
Payload: &disk.LVMVolumeGroup{
|
||||
Name: "rootvg",
|
||||
Description: "built with lvm2 and osbuild",
|
||||
LogicalVolumes: []disk.LVMLogicalVolume{
|
||||
{
|
||||
Size: 8 * datasizes.GibiByte,
|
||||
Name: "rootlv",
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
arch.ARCH_AARCH64.String(): disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: disk.PT_GPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 501 * datasizes.MebiByte,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
Label: "EFI-SYSTEM",
|
||||
FSTabOptions: "umask=0077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 1 * datasizes.GibiByte,
|
||||
Type: disk.XBootLDRPartitionGUID,
|
||||
UUID: disk.DataPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Mountpoint: "/boot",
|
||||
Label: "boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 1,
|
||||
FSTabPassNo: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.LUKSContainer{
|
||||
Label: "crypt_root",
|
||||
Cipher: "cipher_null",
|
||||
Passphrase: "osbuild",
|
||||
PBKDF: disk.Argon2id{
|
||||
Memory: 32,
|
||||
Iterations: 4,
|
||||
Parallelism: 1,
|
||||
},
|
||||
Clevis: &disk.ClevisBind{
|
||||
Pin: "null",
|
||||
Policy: "{}",
|
||||
RemovePassphrase: true,
|
||||
},
|
||||
Payload: &disk.LVMVolumeGroup{
|
||||
Name: "rootvg",
|
||||
Description: "built with lvm2 and osbuild",
|
||||
LogicalVolumes: []disk.LVMLogicalVolume{
|
||||
{
|
||||
Size: 8 * datasizes.GibiByte,
|
||||
Name: "rootlv",
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "ext4",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
104
vendor/github.com/osbuild/images/pkg/distro/image_config.go
generated
vendored
104
vendor/github.com/osbuild/images/pkg/distro/image_config.go
generated
vendored
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/osbuild/images/internal/common"
|
||||
"github.com/osbuild/images/pkg/customizations/fsnode"
|
||||
"github.com/osbuild/images/pkg/customizations/shell"
|
||||
"github.com/osbuild/images/pkg/customizations/subscription"
|
||||
|
|
@ -12,19 +13,22 @@ import (
|
|||
|
||||
// ImageConfig represents a (default) configuration applied to the image payload.
|
||||
type ImageConfig struct {
|
||||
Hostname *string
|
||||
Timezone *string
|
||||
Hostname *string `yaml:"hostname,omitempty"`
|
||||
Timezone *string `yaml:"timezone,omitempty"`
|
||||
TimeSynchronization *osbuild.ChronyStageOptions
|
||||
Locale *string
|
||||
Locale *string `yaml:"locale,omitempty"`
|
||||
Keyboard *osbuild.KeymapStageOptions
|
||||
EnabledServices []string
|
||||
DisabledServices []string
|
||||
MaskedServices []string
|
||||
DefaultTarget *string
|
||||
Sysconfig []*osbuild.SysconfigStageOptions
|
||||
|
||||
Sysconfig *Sysconfig `yaml:"sysconfig,omitempty"`
|
||||
DefaultKernel *string `yaml:"default_kernel,omitempty"`
|
||||
UpdateDefaultKernel *bool `yaml:"update_default_kernel,omitempty"`
|
||||
|
||||
// List of files from which to import GPG keys into the RPM database
|
||||
GPGKeyFiles []string
|
||||
GPGKeyFiles []string `yaml:"gpgkey_files,omitempty"`
|
||||
|
||||
// Disable SELinux labelling
|
||||
NoSElinux *bool
|
||||
|
|
@ -64,7 +68,8 @@ type ImageConfig struct {
|
|||
Firewall *osbuild.FirewallStageOptions
|
||||
UdevRules *osbuild.UdevRulesStageOptions
|
||||
GCPGuestAgentConfig *osbuild.GcpGuestAgentConfigOptions
|
||||
WSLConfig *osbuild.WSLConfStageOptions
|
||||
|
||||
WSLConfig *WSLConfig
|
||||
|
||||
Files []*fsnode.File
|
||||
Directories []*fsnode.Directory
|
||||
|
|
@ -75,15 +80,15 @@ type ImageConfig struct {
|
|||
//
|
||||
// This should only be used for old distros that use grub and it is
|
||||
// applied on all architectures, except for s390x.
|
||||
KernelOptionsBootloader *bool
|
||||
KernelOptionsBootloader *bool `yaml:"kernel_options_bootloader,omitempty"`
|
||||
|
||||
// The default OSCAP datastream to use for the image as a fallback,
|
||||
// if no datastream value is provided by the user.
|
||||
DefaultOSCAPDatastream *string
|
||||
DefaultOSCAPDatastream *string `yaml:"default_oscap_datastream,omitempty"`
|
||||
|
||||
// NoBLS configures the image bootloader with traditional menu entries
|
||||
// instead of BLS. Required for legacy systems like RHEL 7.
|
||||
NoBLS *bool
|
||||
NoBLS *bool `yaml:"no_bls,omitempty"`
|
||||
|
||||
// OSTree specific configuration
|
||||
|
||||
|
|
@ -98,18 +103,22 @@ type ImageConfig struct {
|
|||
|
||||
// InstallWeakDeps enables installation of weak dependencies for packages
|
||||
// that are statically defined for the pipeline.
|
||||
InstallWeakDeps *bool
|
||||
InstallWeakDeps *bool `yaml:"install_weak_deps,omitempty"`
|
||||
|
||||
// How to handle the /etc/machine-id file, when set to true it causes the
|
||||
// machine id to be set to 'uninitialized' which causes ConditionFirstboot
|
||||
// to be triggered in systemd
|
||||
MachineIdUninitialized *bool
|
||||
MachineIdUninitialized *bool `yaml:"machine_id_uninitialized,omitempty"`
|
||||
|
||||
// MountUnits creates systemd .mount units to describe the filesystem
|
||||
// instead of writing to /etc/fstab
|
||||
MountUnits *bool
|
||||
}
|
||||
|
||||
type WSLConfig struct {
|
||||
BootSystemd bool
|
||||
}
|
||||
|
||||
// InheritFrom inherits unset values from the provided parent configuration and
|
||||
// returns a new structure instance, which is a result of the inheritance.
|
||||
func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig {
|
||||
|
|
@ -134,3 +143,76 @@ func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig {
|
|||
}
|
||||
return &finalConfig
|
||||
}
|
||||
|
||||
func (c *ImageConfig) WSLConfStageOptions() *osbuild.WSLConfStageOptions {
|
||||
if c.WSLConfig == nil {
|
||||
return nil
|
||||
}
|
||||
return &osbuild.WSLConfStageOptions{
|
||||
Boot: osbuild.WSLConfBootOptions{
|
||||
Systemd: c.WSLConfig.BootSystemd,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type Sysconfig struct {
|
||||
Networking bool `yaml:"networking,omitempty"`
|
||||
NoZeroConf bool `yaml:"no_zero_conf,omitempty"`
|
||||
|
||||
CreateDefaultNetworkScripts bool `yaml:"create_default_network_scripts,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ImageConfig) SysconfigStageOptions() []*osbuild.SysconfigStageOptions {
|
||||
var opts *osbuild.SysconfigStageOptions
|
||||
|
||||
if c.DefaultKernel != nil {
|
||||
if opts == nil {
|
||||
opts = &osbuild.SysconfigStageOptions{}
|
||||
}
|
||||
if opts.Kernel == nil {
|
||||
opts.Kernel = &osbuild.SysconfigKernelOptions{}
|
||||
}
|
||||
opts.Kernel.DefaultKernel = *c.DefaultKernel
|
||||
}
|
||||
if c.UpdateDefaultKernel != nil {
|
||||
if opts == nil {
|
||||
opts = &osbuild.SysconfigStageOptions{}
|
||||
}
|
||||
if opts.Kernel == nil {
|
||||
opts.Kernel = &osbuild.SysconfigKernelOptions{}
|
||||
}
|
||||
opts.Kernel.UpdateDefault = *c.UpdateDefaultKernel
|
||||
}
|
||||
if c.Sysconfig != nil {
|
||||
if c.Sysconfig.Networking {
|
||||
if opts == nil {
|
||||
opts = &osbuild.SysconfigStageOptions{}
|
||||
}
|
||||
if opts.Network == nil {
|
||||
opts.Network = &osbuild.SysconfigNetworkOptions{}
|
||||
}
|
||||
opts.Network.Networking = c.Sysconfig.Networking
|
||||
opts.Network.NoZeroConf = c.Sysconfig.NoZeroConf
|
||||
if c.Sysconfig.CreateDefaultNetworkScripts {
|
||||
opts.NetworkScripts = &osbuild.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.ToPtr(true),
|
||||
Type: osbuild.IfcfgTypeEthernet,
|
||||
UserCtl: common.ToPtr(true),
|
||||
PeerDNS: common.ToPtr(true),
|
||||
IPv6Init: common.ToPtr(false),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if opts == nil {
|
||||
return nil
|
||||
}
|
||||
return []*osbuild.SysconfigStageOptions{opts}
|
||||
}
|
||||
|
|
|
|||
7
vendor/github.com/osbuild/images/pkg/distro/rhel/images.go
generated
vendored
7
vendor/github.com/osbuild/images/pkg/distro/rhel/images.go
generated
vendored
|
|
@ -228,6 +228,9 @@ func osCustomizations(
|
|||
var subscriptionStatus subscription.RHSMStatus
|
||||
if options.Subscription != nil {
|
||||
subscriptionStatus = subscription.RHSMConfigWithSubscription
|
||||
if options.Subscription.Proxy != "" {
|
||||
osc.InsightsClientConfig = &osbuild.InsightsClientConfigStageOptions{Proxy: options.Subscription.Proxy}
|
||||
}
|
||||
} else {
|
||||
subscriptionStatus = subscription.RHSMConfigNoSubscription
|
||||
}
|
||||
|
|
@ -241,7 +244,7 @@ func osCustomizations(
|
|||
|
||||
osc.ShellInit = imageConfig.ShellInit
|
||||
osc.Grub2Config = imageConfig.Grub2Config
|
||||
osc.Sysconfig = imageConfig.Sysconfig
|
||||
osc.Sysconfig = imageConfig.SysconfigStageOptions()
|
||||
osc.SystemdLogind = imageConfig.SystemdLogind
|
||||
osc.CloudInit = imageConfig.CloudInit
|
||||
osc.Modprobe = imageConfig.Modprobe
|
||||
|
|
@ -263,7 +266,7 @@ func osCustomizations(
|
|||
osc.WAAgentConfig = imageConfig.WAAgentConfig
|
||||
osc.UdevRules = imageConfig.UdevRules
|
||||
osc.GCPGuestAgentConfig = imageConfig.GCPGuestAgentConfig
|
||||
osc.WSLConfig = imageConfig.WSLConfig
|
||||
osc.WSLConfig = imageConfig.WSLConfStageOptions()
|
||||
|
||||
osc.Files = append(osc.Files, imageConfig.Files...)
|
||||
osc.Directories = append(osc.Directories, imageConfig.Directories...)
|
||||
|
|
|
|||
15
vendor/github.com/osbuild/images/pkg/distro/rhel/imagetype.go
generated
vendored
15
vendor/github.com/osbuild/images/pkg/distro/rhel/imagetype.go
generated
vendored
|
|
@ -187,6 +187,21 @@ func (t *ImageType) BootMode() platform.BootMode {
|
|||
return platform.BOOT_NONE
|
||||
}
|
||||
|
||||
func (t *ImageType) BasePartitionTable() (*disk.PartitionTable, error) {
|
||||
// XXX: simplify once https://github.com/osbuild/images/pull/1372
|
||||
// (or something similar) went in, see pkg/distro/fedora, once
|
||||
// the yaml based loading is in we can drop from ImageType
|
||||
// "BasePartitionTables BasePartitionTableFunc"
|
||||
if t.BasePartitionTables == nil {
|
||||
return nil, nil
|
||||
}
|
||||
basePartitionTable, exists := t.BasePartitionTables(t)
|
||||
if !exists {
|
||||
return nil, nil
|
||||
}
|
||||
return &basePartitionTable, nil
|
||||
}
|
||||
|
||||
func (t *ImageType) GetPartitionTable(
|
||||
customizations *blueprint.Customizations,
|
||||
options distro.ImageOptions,
|
||||
|
|
|
|||
18
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go
generated
vendored
18
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go
generated
vendored
|
|
@ -203,18 +203,12 @@ func defaultEc2ImageConfig() *distro.ImageConfig {
|
|||
"reboot.target",
|
||||
"tuned",
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
SystemdLogind: []*osbuild.SystemdLogindStageOptions{
|
||||
{
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go
generated
vendored
|
|
@ -321,17 +321,11 @@ func defaultAzureImageConfig(rd *rhel.Distribution) *distro.ImageConfig {
|
|||
Layouts: []string{"us"},
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel-core",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
EnabledServices: []string{
|
||||
"firewalld",
|
||||
|
|
|
|||
21
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go
generated
vendored
21
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go
generated
vendored
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/customizations/oscap"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/defs"
|
||||
"github.com/osbuild/images/pkg/distro/rhel"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
"github.com/osbuild/images/pkg/platform"
|
||||
)
|
||||
|
||||
|
|
@ -50,24 +50,7 @@ func distroISOLabelFunc(t *rhel.ImageType) string {
|
|||
}
|
||||
|
||||
func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig {
|
||||
return &distro.ImageConfig{
|
||||
Timezone: common.ToPtr("UTC"),
|
||||
Locale: common.ToPtr("C.UTF-8"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultOSCAPDatastream: common.ToPtr(oscap.DefaultRHEL10Datastream(d.IsRHEL())),
|
||||
InstallWeakDeps: common.ToPtr(true),
|
||||
}
|
||||
return common.Must(defs.DistroImageConfig(d.Name()))
|
||||
}
|
||||
|
||||
func newDistro(name string, major, minor int) *rhel.Distribution {
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/gce.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/gce.go
generated
vendored
|
|
@ -108,14 +108,14 @@ func baseGCEImageConfig() *distro.ImageConfig {
|
|||
PermitRootLogin: osbuild.PermitRootLoginValueNo,
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
DefaultKernel: "kernel-core",
|
||||
UpdateDefault: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
// XXX: ensure the "old" behavior is preserved (that is
|
||||
// likely a bug) where for GCE the sysconfig network
|
||||
// options are not set because the merge of imageConfig
|
||||
// is shallow and the previous setup was changing the
|
||||
// kernel without also changing the network options.
|
||||
Sysconfig: &distro.Sysconfig{},
|
||||
Modprobe: []*osbuild.ModprobeStageOptions{
|
||||
{
|
||||
Filename: "blacklist-floppy.conf",
|
||||
|
|
|
|||
6
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ubi.go
generated
vendored
6
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ubi.go
generated
vendored
|
|
@ -37,10 +37,8 @@ func mkWSLImgType() *rhel.ImageType {
|
|||
},
|
||||
},
|
||||
NoSElinux: common.ToPtr(true),
|
||||
WSLConfig: &osbuild.WSLConfStageOptions{
|
||||
Boot: osbuild.WSLConfBootOptions{
|
||||
Systemd: true,
|
||||
},
|
||||
WSLConfig: &distro.WSLConfig{
|
||||
BootSystemd: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
32
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/ami.go
generated
vendored
32
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/ami.go
generated
vendored
|
|
@ -108,31 +108,13 @@ func ec2ImageConfig() *distro.ImageConfig {
|
|||
"sshd",
|
||||
"rsyslog",
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.ToPtr(true),
|
||||
Type: osbuild.IfcfgTypeEthernet,
|
||||
UserCtl: common.ToPtr(true),
|
||||
PeerDNS: common.ToPtr(true),
|
||||
IPv6Init: common.ToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
CreateDefaultNetworkScripts: true,
|
||||
},
|
||||
SystemdLogind: []*osbuild.SystemdLogindStageOptions{
|
||||
{
|
||||
|
|
|
|||
17
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/azure.go
generated
vendored
17
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/azure.go
generated
vendored
|
|
@ -49,17 +49,12 @@ var azureDefaultImgConfig = &distro.ImageConfig{
|
|||
},
|
||||
SELinuxForceRelabel: common.ToPtr(true),
|
||||
Authconfig: &osbuild.AuthconfigStageOptions{},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel-core",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
EnabledServices: []string{
|
||||
"cloud-config",
|
||||
|
|
|
|||
25
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/distro.go
generated
vendored
25
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/distro.go
generated
vendored
|
|
@ -6,35 +6,14 @@ import (
|
|||
"github.com/osbuild/images/internal/common"
|
||||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/defs"
|
||||
"github.com/osbuild/images/pkg/distro/rhel"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
"github.com/osbuild/images/pkg/platform"
|
||||
)
|
||||
|
||||
// RHEL-based OS image configuration defaults
|
||||
func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig {
|
||||
return &distro.ImageConfig{
|
||||
Timezone: common.ToPtr("America/New_York"),
|
||||
Locale: common.ToPtr("en_US.UTF-8"),
|
||||
GPGKeyFiles: []string{
|
||||
"/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
KernelOptionsBootloader: common.ToPtr(true),
|
||||
NoBLS: common.ToPtr(true), // RHEL 7 grub does not support BLS
|
||||
InstallWeakDeps: common.ToPtr(true),
|
||||
}
|
||||
return common.Must(defs.DistroImageConfig(d.Name()))
|
||||
}
|
||||
|
||||
func newDistro(name string, minor int) *rhel.Distribution {
|
||||
|
|
|
|||
30
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/qcow2.go
generated
vendored
30
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel7/qcow2.go
generated
vendored
|
|
@ -38,30 +38,12 @@ func mkQcow2ImgType() *rhel.ImageType {
|
|||
var qcow2DefaultImgConfig = &distro.ImageConfig{
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
SELinuxForceRelabel: common.ToPtr(true),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.ToPtr(true),
|
||||
Type: osbuild.IfcfgTypeEthernet,
|
||||
UserCtl: common.ToPtr(true),
|
||||
PeerDNS: common.ToPtr(true),
|
||||
IPv6Init: common.ToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
CreateDefaultNetworkScripts: true,
|
||||
},
|
||||
RHSMConfig: map[subscription.RHSMStatus]*subscription.RHSMConfig{
|
||||
subscription.RHSMConfigNoSubscription: {
|
||||
|
|
|
|||
32
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go
generated
vendored
32
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go
generated
vendored
|
|
@ -197,31 +197,13 @@ func baseEc2ImageConfig() *distro.ImageConfig {
|
|||
"cloud-final",
|
||||
"reboot.target",
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.ToPtr(true),
|
||||
Type: osbuild.IfcfgTypeEthernet,
|
||||
UserCtl: common.ToPtr(true),
|
||||
PeerDNS: common.ToPtr(true),
|
||||
IPv6Init: common.ToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
CreateDefaultNetworkScripts: true,
|
||||
},
|
||||
SystemdLogind: []*osbuild.SystemdLogindStageOptions{
|
||||
{
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go
generated
vendored
|
|
@ -370,17 +370,11 @@ var defaultAzureImageConfig = &distro.ImageConfig{
|
|||
Layouts: []string{"us"},
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel-core",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
EnabledServices: []string{
|
||||
"nm-cloud-setup.service",
|
||||
|
|
|
|||
22
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go
generated
vendored
22
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go
generated
vendored
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/customizations/oscap"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/defs"
|
||||
"github.com/osbuild/images/pkg/distro/rhel"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
"github.com/osbuild/images/pkg/platform"
|
||||
)
|
||||
|
||||
|
|
@ -37,25 +37,7 @@ var (
|
|||
|
||||
// RHEL-based OS image configuration defaults
|
||||
func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig {
|
||||
return &distro.ImageConfig{
|
||||
Timezone: common.ToPtr("America/New_York"),
|
||||
Locale: common.ToPtr("en_US.UTF-8"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
KernelOptionsBootloader: common.ToPtr(true),
|
||||
DefaultOSCAPDatastream: common.ToPtr(oscap.DefaultRHEL8Datastream(d.IsRHEL())),
|
||||
InstallWeakDeps: common.ToPtr(true),
|
||||
}
|
||||
return common.Must(defs.DistroImageConfig(d.Name()))
|
||||
}
|
||||
|
||||
func distroISOLabelFunc(t *rhel.ImageType) string {
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/gce.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/gce.go
generated
vendored
|
|
@ -129,14 +129,14 @@ func defaultGceByosImageConfig(rd distro.Distro) *distro.ImageConfig {
|
|||
PermitRootLogin: osbuild.PermitRootLoginValueNo,
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
DefaultKernel: "kernel-core",
|
||||
UpdateDefault: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
// XXX: ensure the "old" behavior is preserved (that is
|
||||
// likely a bug) where for GCE the sysconfig network
|
||||
// options are not set because the merge of imageConfig
|
||||
// is shallow and the previous setup was changing the
|
||||
// kernel without also changing the network options.
|
||||
Sysconfig: &distro.Sysconfig{},
|
||||
Modprobe: []*osbuild.ModprobeStageOptions{
|
||||
{
|
||||
Filename: "blacklist-floppy.conf",
|
||||
|
|
|
|||
7
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ubi.go
generated
vendored
7
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ubi.go
generated
vendored
|
|
@ -4,7 +4,6 @@ import (
|
|||
"github.com/osbuild/images/internal/common"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/rhel"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
)
|
||||
|
||||
func mkWslImgType() *rhel.ImageType {
|
||||
|
|
@ -24,10 +23,8 @@ func mkWslImgType() *rhel.ImageType {
|
|||
it.DefaultImageConfig = &distro.ImageConfig{
|
||||
Locale: common.ToPtr("en_US.UTF-8"),
|
||||
NoSElinux: common.ToPtr(true),
|
||||
WSLConfig: &osbuild.WSLConfStageOptions{
|
||||
Boot: osbuild.WSLConfBootOptions{
|
||||
Systemd: true,
|
||||
},
|
||||
WSLConfig: &distro.WSLConfig{
|
||||
BootSystemd: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
33
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go
generated
vendored
33
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go
generated
vendored
|
|
@ -50,31 +50,14 @@ func defaultEc2ImageConfig() *distro.ImageConfig {
|
|||
"reboot.target",
|
||||
"tuned",
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.ToPtr(true),
|
||||
Type: osbuild.IfcfgTypeEthernet,
|
||||
UserCtl: common.ToPtr(true),
|
||||
PeerDNS: common.ToPtr(true),
|
||||
IPv6Init: common.ToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultTarget: common.ToPtr("multi-user.target"),
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel"),
|
||||
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
CreateDefaultNetworkScripts: true,
|
||||
},
|
||||
SystemdLogind: []*osbuild.SystemdLogindStageOptions{
|
||||
{
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go
generated
vendored
|
|
@ -334,17 +334,11 @@ func defaultAzureImageConfig(rd *rhel.Distribution) *distro.ImageConfig {
|
|||
Layouts: []string{"us"},
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel-core",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
Sysconfig: &distro.Sysconfig{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
EnabledServices: []string{
|
||||
"firewalld",
|
||||
|
|
|
|||
21
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go
generated
vendored
21
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go
generated
vendored
|
|
@ -8,8 +8,8 @@ import (
|
|||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/customizations/oscap"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/defs"
|
||||
"github.com/osbuild/images/pkg/distro/rhel"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
"github.com/osbuild/images/pkg/platform"
|
||||
)
|
||||
|
||||
|
|
@ -53,24 +53,7 @@ func distroISOLabelFunc(t *rhel.ImageType) string {
|
|||
}
|
||||
|
||||
func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig {
|
||||
return &distro.ImageConfig{
|
||||
Timezone: common.ToPtr("America/New_York"),
|
||||
Locale: common.ToPtr("C.UTF-8"),
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
DefaultOSCAPDatastream: common.ToPtr(oscap.DefaultRHEL9Datastream(d.IsRHEL())),
|
||||
InstallWeakDeps: common.ToPtr(true),
|
||||
}
|
||||
return common.Must(defs.DistroImageConfig(d.Name()))
|
||||
}
|
||||
|
||||
func newDistro(name string, major, minor int) *rhel.Distribution {
|
||||
|
|
|
|||
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/gce.go
generated
vendored
16
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/gce.go
generated
vendored
|
|
@ -105,14 +105,14 @@ func baseGCEImageConfig() *distro.ImageConfig {
|
|||
PermitRootLogin: osbuild.PermitRootLoginValueNo,
|
||||
},
|
||||
},
|
||||
Sysconfig: []*osbuild.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild.SysconfigKernelOptions{
|
||||
DefaultKernel: "kernel-core",
|
||||
UpdateDefault: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
UpdateDefaultKernel: common.ToPtr(true),
|
||||
DefaultKernel: common.ToPtr("kernel-core"),
|
||||
// XXX: ensure the "old" behavior is preserved (that is
|
||||
// likely a bug) where for GCE the sysconfig network
|
||||
// options are not set because the merge of imageConfig
|
||||
// is shallow and the previous setup was changing the
|
||||
// kernel without also changing the network options.
|
||||
Sysconfig: &distro.Sysconfig{},
|
||||
Modprobe: []*osbuild.ModprobeStageOptions{
|
||||
{
|
||||
Filename: "blacklist-floppy.conf",
|
||||
|
|
|
|||
6
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ubi.go
generated
vendored
6
vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ubi.go
generated
vendored
|
|
@ -38,10 +38,8 @@ func mkWSLImgType() *rhel.ImageType {
|
|||
},
|
||||
Locale: common.ToPtr("en_US.UTF-8"),
|
||||
NoSElinux: common.ToPtr(true),
|
||||
WSLConfig: &osbuild.WSLConfStageOptions{
|
||||
Boot: osbuild.WSLConfBootOptions{
|
||||
Systemd: true,
|
||||
},
|
||||
WSLConfig: &distro.WSLConfig{
|
||||
BootSystemd: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
4
vendor/github.com/osbuild/images/pkg/distro/test_distro/distro.go
generated
vendored
4
vendor/github.com/osbuild/images/pkg/distro/test_distro/distro.go
generated
vendored
|
|
@ -212,6 +212,10 @@ func (t *TestImageType) PartitionType() disk.PartitionTableType {
|
|||
return disk.PT_NONE
|
||||
}
|
||||
|
||||
func (t *TestImageType) BasePartitionTable() (*disk.PartitionTable, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (t *TestImageType) BootMode() platform.BootMode {
|
||||
return platform.BOOT_HYBRID
|
||||
}
|
||||
|
|
|
|||
65
vendor/github.com/osbuild/images/pkg/manifest/os.go
generated
vendored
65
vendor/github.com/osbuild/images/pkg/manifest/os.go
generated
vendored
|
|
@ -99,35 +99,36 @@ type OSCustomizations struct {
|
|||
ShellInit []shell.InitFile
|
||||
|
||||
// TODO: drop osbuild types from the API
|
||||
Firewall *osbuild.FirewallStageOptions
|
||||
Grub2Config *osbuild.GRUB2Config
|
||||
Sysconfig []*osbuild.SysconfigStageOptions
|
||||
SystemdLogind []*osbuild.SystemdLogindStageOptions
|
||||
CloudInit []*osbuild.CloudInitStageOptions
|
||||
Modprobe []*osbuild.ModprobeStageOptions
|
||||
DracutConf []*osbuild.DracutConfStageOptions
|
||||
SystemdUnit []*osbuild.SystemdUnitStageOptions
|
||||
Authselect *osbuild.AuthselectStageOptions
|
||||
SELinuxConfig *osbuild.SELinuxConfigStageOptions
|
||||
Tuned *osbuild.TunedStageOptions
|
||||
Tmpfilesd []*osbuild.TmpfilesdStageOptions
|
||||
PamLimitsConf []*osbuild.PamLimitsConfStageOptions
|
||||
Sysctld []*osbuild.SysctldStageOptions
|
||||
DNFConfig []*osbuild.DNFConfigStageOptions
|
||||
DNFAutomaticConfig *osbuild.DNFAutomaticConfigStageOptions
|
||||
YUMConfig *osbuild.YumConfigStageOptions
|
||||
YUMRepos []*osbuild.YumReposStageOptions
|
||||
SshdConfig *osbuild.SshdConfigStageOptions
|
||||
GCPGuestAgentConfig *osbuild.GcpGuestAgentConfigOptions
|
||||
AuthConfig *osbuild.AuthconfigStageOptions
|
||||
PwQuality *osbuild.PwqualityConfStageOptions
|
||||
NTPServers []osbuild.ChronyConfigServer
|
||||
WAAgentConfig *osbuild.WAAgentConfStageOptions
|
||||
UdevRules *osbuild.UdevRulesStageOptions
|
||||
WSLConfig *osbuild.WSLConfStageOptions
|
||||
LeapSecTZ *string
|
||||
Presets []osbuild.Preset
|
||||
ContainersStorage *string
|
||||
Firewall *osbuild.FirewallStageOptions
|
||||
Grub2Config *osbuild.GRUB2Config
|
||||
Sysconfig []*osbuild.SysconfigStageOptions
|
||||
SystemdLogind []*osbuild.SystemdLogindStageOptions
|
||||
CloudInit []*osbuild.CloudInitStageOptions
|
||||
Modprobe []*osbuild.ModprobeStageOptions
|
||||
DracutConf []*osbuild.DracutConfStageOptions
|
||||
SystemdUnit []*osbuild.SystemdUnitStageOptions
|
||||
Authselect *osbuild.AuthselectStageOptions
|
||||
SELinuxConfig *osbuild.SELinuxConfigStageOptions
|
||||
Tuned *osbuild.TunedStageOptions
|
||||
Tmpfilesd []*osbuild.TmpfilesdStageOptions
|
||||
PamLimitsConf []*osbuild.PamLimitsConfStageOptions
|
||||
Sysctld []*osbuild.SysctldStageOptions
|
||||
DNFConfig []*osbuild.DNFConfigStageOptions
|
||||
DNFAutomaticConfig *osbuild.DNFAutomaticConfigStageOptions
|
||||
YUMConfig *osbuild.YumConfigStageOptions
|
||||
YUMRepos []*osbuild.YumReposStageOptions
|
||||
SshdConfig *osbuild.SshdConfigStageOptions
|
||||
GCPGuestAgentConfig *osbuild.GcpGuestAgentConfigOptions
|
||||
AuthConfig *osbuild.AuthconfigStageOptions
|
||||
PwQuality *osbuild.PwqualityConfStageOptions
|
||||
NTPServers []osbuild.ChronyConfigServer
|
||||
WAAgentConfig *osbuild.WAAgentConfStageOptions
|
||||
UdevRules *osbuild.UdevRulesStageOptions
|
||||
WSLConfig *osbuild.WSLConfStageOptions
|
||||
InsightsClientConfig *osbuild.InsightsClientConfigStageOptions
|
||||
LeapSecTZ *string
|
||||
Presets []osbuild.Preset
|
||||
ContainersStorage *string
|
||||
|
||||
// OpenSCAP config
|
||||
OpenSCAPRemediationConfig *oscap.RemediationConfig
|
||||
|
|
@ -634,7 +635,11 @@ func (p *OS) serialize() osbuild.Pipeline {
|
|||
}
|
||||
|
||||
if p.SshdConfig != nil {
|
||||
pipeline.AddStage((osbuild.NewSshdConfigStage(p.SshdConfig)))
|
||||
pipeline.AddStage(osbuild.NewSshdConfigStage(p.SshdConfig))
|
||||
}
|
||||
|
||||
if p.InsightsClientConfig != nil {
|
||||
pipeline.AddStage(osbuild.NewInsightsClientConfigStage(p.InsightsClientConfig))
|
||||
}
|
||||
|
||||
if p.AuthConfig != nil {
|
||||
|
|
|
|||
15
vendor/github.com/osbuild/images/pkg/osbuild/insights_client_config_stage.go
generated
vendored
Normal file
15
vendor/github.com/osbuild/images/pkg/osbuild/insights_client_config_stage.go
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package osbuild
|
||||
|
||||
type InsightsClientConfigStageOptions struct {
|
||||
Proxy string `json:"proxy,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
func (InsightsClientConfigStageOptions) isStageOptions() {}
|
||||
|
||||
func NewInsightsClientConfigStage(options *InsightsClientConfigStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Type: "org.osbuild.insights-client.config",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
18
vendor/github.com/osbuild/images/pkg/osbuild/sysconfig_stage.go
generated
vendored
18
vendor/github.com/osbuild/images/pkg/osbuild/sysconfig_stage.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
package osbuild
|
||||
|
||||
type SysconfigStageOptions struct {
|
||||
Kernel *SysconfigKernelOptions `json:"kernel,omitempty"`
|
||||
Network *SysconfigNetworkOptions `json:"network,omitempty"`
|
||||
NetworkScripts *NetworkScriptsOptions `json:"network-scripts,omitempty"`
|
||||
Desktop *SysconfigDesktopOptions `json:"desktop,omitempty"`
|
||||
LiveSys *SysconfigLivesysOptions `json:"livesys,omitempty"`
|
||||
Kernel *SysconfigKernelOptions `json:"kernel,omitempty" yaml:"kernel,omitempty"`
|
||||
Network *SysconfigNetworkOptions `json:"network,omitempty" yaml:"network,omitempty"`
|
||||
NetworkScripts *NetworkScriptsOptions `json:"network-scripts,omitempty" yaml:"network-scripts,omitempty"`
|
||||
Desktop *SysconfigDesktopOptions `json:"desktop,omitempty" yaml:"desktop,omitempty"`
|
||||
LiveSys *SysconfigLivesysOptions `json:"livesys,omitempty" yaml:"libesys,omitempty"`
|
||||
}
|
||||
|
||||
func (SysconfigStageOptions) isStageOptions() {}
|
||||
|
|
@ -19,12 +19,14 @@ func NewSysconfigStage(options *SysconfigStageOptions) *Stage {
|
|||
|
||||
type SysconfigNetworkOptions struct {
|
||||
Networking bool `json:"networking,omitempty"`
|
||||
NoZeroConf bool `json:"no_zero_conf,omitempty"`
|
||||
// XXX: ideally this would be no_zeroconf" (because zeroconf
|
||||
// is the program name) but we need to keep for compatibility
|
||||
NoZeroConf bool `json:"no_zero_conf,omitempty" yaml:"no_zero_conf,omitempty"`
|
||||
}
|
||||
|
||||
type SysconfigKernelOptions struct {
|
||||
UpdateDefault bool `json:"update_default,omitempty"`
|
||||
DefaultKernel string `json:"default_kernel,omitempty"`
|
||||
UpdateDefault bool `json:"update_default,omitempty" yaml:"update_default,omitempty"`
|
||||
DefaultKernel string `json:"default_kernel,omitempty" yaml:"default_kernel,omitempty"`
|
||||
}
|
||||
|
||||
type SysconfigDesktopOptions struct {
|
||||
|
|
|
|||
1
vendor/github.com/osbuild/images/pkg/osbuild/systemd_unit_create_stage.go
generated
vendored
1
vendor/github.com/osbuild/images/pkg/osbuild/systemd_unit_create_stage.go
generated
vendored
|
|
@ -244,6 +244,7 @@ func GenSystemdMountStages(pt *disk.PartitionTable) ([]*Stage, error) {
|
|||
}
|
||||
|
||||
options := &SystemdUnitCreateStageOptions{
|
||||
UnitPath: EtcUnitPath, // create all mount units in /etc/systemd/
|
||||
Config: SystemdUnit{
|
||||
Unit: &UnitSection{
|
||||
// Adds the following dependencies for mount units (systemd.mount(5)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue