Skip to content

Commit 7033275

Browse files
committed
refactor: move BootloaderKind into machinery
This type is used in Image Factory schematic, so move it into machinery so that it can be imported into IF without pulling Talos core. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 71adaf0 commit 7033275

File tree

6 files changed

+131
-102
lines changed

6 files changed

+131
-102
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ COPY --from=go-generate /src/pkg/imager/profile/ /pkg/imager/profile/
423423
COPY --from=go-generate /src/pkg/machinery/resources/ /pkg/machinery/resources/
424424
COPY --from=go-generate /src/pkg/machinery/config/schemas/ /pkg/machinery/config/schemas/
425425
COPY --from=go-generate /src/pkg/machinery/config/types/ /pkg/machinery/config/types/
426+
COPY --from=go-generate /src/pkg/machinery/imager/imageropts/ /pkg/machinery/imager/imageropts/
426427
COPY --from=go-generate /src/pkg/machinery/nethelpers/ /pkg/machinery/nethelpers/
427428
COPY --from=go-generate /src/pkg/machinery/extensions/ /pkg/machinery/extensions/
428429
COPY --from=go-generate /src/pkg/machinery/version/os-release /pkg/machinery/version/os-release

pkg/imager/profile/output.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package profile
66

77
import (
8+
"github.com/siderolabs/talos/pkg/machinery/imager/imageropts"
89
"github.com/siderolabs/talos/pkg/machinery/imager/quirks"
910
)
1011

@@ -109,18 +110,14 @@ const (
109110
)
110111

111112
// BootloaderKind is a bootloader for the disk image.
112-
type BootloaderKind int
113+
type BootloaderKind = imageropts.BootloaderKind
113114

115+
// BootloaderKind values re-exported from imageropts.
114116
const (
115-
// BootLoaderKindNone is the zero value.
116-
BootLoaderKindNone BootloaderKind = iota // none
117-
// BootLoaderKindDualBoot is the dual-boot bootloader.
118-
// using sd-boot for UEFI and GRUB for BIOS.
119-
BootLoaderKindDualBoot // dual-boot
120-
// BootLoaderKindSDBoot is the sd-boot bootloader.
121-
BootLoaderKindSDBoot // sd-boot
122-
// BootLoaderKindGrub is the GRUB bootloader.
123-
BootLoaderKindGrub // grub
117+
BootLoaderKindNone = imageropts.BootLoaderKindNone
118+
BootLoaderKindDualBoot = imageropts.BootLoaderKindDualBoot
119+
BootLoaderKindSDBoot = imageropts.BootLoaderKindSDBoot
120+
BootLoaderKindGrub = imageropts.BootLoaderKindGrub
124121
)
125122

126123
// FillDefaults fills default values for the output.

pkg/imager/profile/outputkind_enumer.go

Lines changed: 1 addition & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/imager/profile/profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
//go:generate go tool github.com/siderolabs/deep-copy -type Profile -type SecureBootAssets -header-file ../../../hack/boilerplate.txt -o deep_copy.generated.go .
2121

22-
//go:generate go tool github.com/dmarkham/enumer -type OutputKind,OutFormat,DiskFormat,SDBootEnrollKeys,BootloaderKind -linecomment -text
22+
//go:generate go tool github.com/dmarkham/enumer -type OutputKind,OutFormat,DiskFormat,SDBootEnrollKeys -linecomment -text
2323

2424
// Profile describes image generation result.
2525
type Profile struct {

pkg/machinery/imager/imageropts/bootloaderkind_enumer.go

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
// Package imageropts contains exportable types used in imager profile options.
6+
package imageropts
7+
8+
//go:generate go tool github.com/dmarkham/enumer -type BootloaderKind -linecomment -text
9+
10+
// BootloaderKind is a bootloader for the disk image.
11+
type BootloaderKind int
12+
13+
const (
14+
// BootLoaderKindNone is the zero value.
15+
BootLoaderKindNone BootloaderKind = iota // none
16+
// BootLoaderKindDualBoot is the dual-boot bootloader.
17+
// using sd-boot for UEFI and GRUB for BIOS.
18+
BootLoaderKindDualBoot // dual-boot
19+
// BootLoaderKindSDBoot is the sd-boot bootloader.
20+
BootLoaderKindSDBoot // sd-boot
21+
// BootLoaderKindGrub is the GRUB bootloader.
22+
BootLoaderKindGrub // grub
23+
)

0 commit comments

Comments
 (0)