tag v0.145.0 Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> Changes with 0.145.0 ---------------- * github: run dependabot gomod action weekly (osbuild/images#1476) * Author: Achilleas Koutsou, Reviewers: Lukáš Zapletal — Somewhere on the Internet, 2025-05-12 --- tag v0.146.0 Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> Changes with 0.146.0 ---------------- * Fixes for ESP partition: Make optional, set label (osbuild/images#1525) * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Brian C. Lane * Initial automotive work: custom selinux policy, separate build container for bootc, and ext4 verity (osbuild/images#1519) * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Simon de Vlieger * Update snapshots to 20250512 (osbuild/images#1515) * Author: SchutzBot, Reviewers: Achilleas Koutsou, Simon de Vlieger * disk: make auto-generated /boot 1 GiB big (osbuild/images#1499) * Author: Ondřej Budai, Reviewers: Achilleas Koutsou, Michael Vogt * distro.yaml: Clean up yamllint errors and warnings (osbuild/images#1523) * Author: Brian C. Lane, Reviewers: Michael Vogt, Simon de Vlieger * distro/rhel9: make /boot 1 GiB everywhere (osbuild/images#1498) * Author: Ondřej Budai, Reviewers: Michael Vogt, Simon de Vlieger * distro: move disk/container image types into pure YAML (COMPOSER-2533) (osbuild/images#1508) * Author: Michael Vogt, Reviewers: Achilleas Koutsou, Simon de Vlieger * fedora: move all image types into pure YAML (osbuild/images#1514) * Author: Michael Vogt, Reviewers: Brian C. Lane, Simon de Vlieger * fsnode: fix go-1.24 errors (osbuild/images#1521) * Author: Michael Vogt, Reviewers: Ondřej Budai, Tomáš Hozza * osbuild: add JSON/YAML unmarshal to UdevRulesStageOptions (osbuild/images#1489) * Author: Michael Vogt, Reviewers: Achilleas Koutsou, Simon de Vlieger * test: Run more distro tests in parallel (osbuild/images#1483) * Author: Brian C. Lane, Reviewers: Michael Vogt, Simon de Vlieger — Somewhere on the Internet, 2025-05-19 --- tag v0.147.0 Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> Changes with 0.147.0 ---------------- * Add support for setting partition uuid and label (osbuild/images#1543) * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Simon de Vlieger * Cleanup of new APIs (mkfs options and build container) (osbuild/images#1526) * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Simon de Vlieger * distro/rhel: remove the user/group warnings for edge-commits (osbuild/images#1538) * Author: Achilleas Koutsou, Reviewers: Brian C. Lane, Simon de Vlieger — Somewhere on the Internet, 2025-05-20 --- tag v0.148.0 Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> Changes with 0.148.0 ---------------- * Makefile: add vet command to check for consistent struct tags (osbuild/images#1554) * Author: Michael Vogt, Reviewers: Lukáš Zapletal, Simon de Vlieger * disk: tiny tweaks for the new MkfsOptions support (osbuild/images#1545) * Author: Michael Vogt, Reviewers: Achilleas Koutsou, Alexander Larsson, Lukáš Zapletal * fedora/many: increase `/boot` to 1 GiB (HMS-8604) (osbuild/images#1557) * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Ondřej Budai * fedora/wsl: include `wsl-setup` (HMS-8573) (osbuild/images#1550) * Author: Simon de Vlieger, Reviewers: Brian C. Lane, Michael Vogt * fedora: add `anaconda.ModuleUsers` to ImageInstallerImage (osbuild/images#1558) * Author: Michael Vogt, Reviewers: Brian C. Lane, Simon de Vlieger * fedora: implement setting of the RootfsType via YAML (osbuild/images#1544) * Author: Michael Vogt, Reviewers: Brian C. Lane, Simon de Vlieger * rhel10: move ImageConfig into pure YAML (osbuild/images#1542) * Author: Michael Vogt, Reviewers: Brian C. Lane, Simon de Vlieger — Somewhere on the Internet, 2025-05-26 ---
95 lines
1.6 KiB
Go
95 lines
1.6 KiB
Go
package arch
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"runtime"
|
|
|
|
"github.com/osbuild/images/internal/common"
|
|
)
|
|
|
|
type Arch uint64
|
|
|
|
const ( // architecture enum
|
|
ARCH_UNSET Arch = iota
|
|
ARCH_AARCH64
|
|
ARCH_PPC64LE
|
|
ARCH_S390X
|
|
ARCH_X86_64
|
|
ARCH_RISCV64
|
|
)
|
|
|
|
func (a Arch) String() string {
|
|
switch a {
|
|
case ARCH_UNSET:
|
|
return "unset"
|
|
case ARCH_AARCH64:
|
|
return "aarch64"
|
|
case ARCH_PPC64LE:
|
|
return "ppc64le"
|
|
case ARCH_S390X:
|
|
return "s390x"
|
|
case ARCH_X86_64:
|
|
return "x86_64"
|
|
case ARCH_RISCV64:
|
|
return "riscv64"
|
|
default:
|
|
panic("invalid architecture")
|
|
}
|
|
}
|
|
|
|
func (a *Arch) UnmarshalJSON(data []byte) (err error) {
|
|
var s string
|
|
if err := json.Unmarshal(data, &s); err != nil {
|
|
return err
|
|
}
|
|
*a, err = FromString(s)
|
|
return err
|
|
}
|
|
|
|
func (a *Arch) UnmarshalYAML(unmarshal func(any) error) error {
|
|
return common.UnmarshalYAMLviaJSON(a, unmarshal)
|
|
}
|
|
|
|
func FromString(a string) (Arch, error) {
|
|
switch a {
|
|
case "amd64", "x86_64":
|
|
return ARCH_X86_64, nil
|
|
case "arm64", "aarch64":
|
|
return ARCH_AARCH64, nil
|
|
case "s390x":
|
|
return ARCH_S390X, nil
|
|
case "ppc64le":
|
|
return ARCH_PPC64LE, nil
|
|
case "riscv64":
|
|
return ARCH_RISCV64, nil
|
|
default:
|
|
return ARCH_UNSET, fmt.Errorf("unsupported architecture %q", a)
|
|
}
|
|
}
|
|
|
|
var runtimeGOARCH = runtime.GOARCH
|
|
|
|
func Current() Arch {
|
|
return common.Must(FromString(runtimeGOARCH))
|
|
}
|
|
|
|
func IsX86_64() bool {
|
|
return Current() == ARCH_X86_64
|
|
}
|
|
|
|
func IsAarch64() bool {
|
|
return Current() == ARCH_AARCH64
|
|
}
|
|
|
|
func IsPPC() bool {
|
|
return Current() == ARCH_PPC64LE
|
|
}
|
|
|
|
func IsS390x() bool {
|
|
return Current() == ARCH_S390X
|
|
}
|
|
|
|
func IsRISCV64() bool {
|
|
return Current() == ARCH_RISCV64
|
|
}
|