chore: deprectae bootloader installer option

Deprecate the `bootloader` installer option. This has not been used in a
long while.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2023-06-05 22:46:24 +05:30
parent cdfece7d64
commit 423a31ac9d
No known key found for this signature in database
GPG Key ID: 21A9F444075C9E36
11 changed files with 43 additions and 72 deletions

View File

@ -61,6 +61,8 @@ func Execute() {
var options = &install.Options{}
var bootloader bool
func init() {
rootCmd.PersistentFlags().StringVar(&options.ConfigSource, "config", "", "The value of "+constants.KernelParamConfig)
rootCmd.PersistentFlags().StringVar(&options.Disk, "disk", "", "The path to the disk to install to")
@ -69,7 +71,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&options.Arch, "arch", runtime.GOARCH, "The target architecture")
rootCmd.PersistentFlags().StringVar(&options.Board, "board", constants.BoardNone, "The value of "+constants.KernelParamBoard)
rootCmd.PersistentFlags().StringArrayVar(&options.ExtraKernelArgs, "extra-kernel-arg", []string{}, "Extra argument to pass to the kernel")
rootCmd.PersistentFlags().BoolVar(&options.Bootloader, "bootloader", true, "Install a booloader to the specified disk")
rootCmd.PersistentFlags().BoolVar(&bootloader, "bootloader", true, "Deprecated: no op")
rootCmd.PersistentFlags().BoolVar(&options.Upgrade, "upgrade", false, "Indicates that the install is being performed by an upgrade")
rootCmd.PersistentFlags().BoolVar(&options.Force, "force", false, "Indicates that the install should forcefully format the partition")
rootCmd.PersistentFlags().BoolVar(&options.Zero, "zero", false, "Indicates that the install should write zeros to the disk before installing")

View File

@ -33,7 +33,6 @@ type Options struct {
Arch string
Board string
ExtraKernelArgs []string
Bootloader bool
Upgrade bool
Force bool
Zero bool
@ -286,11 +285,6 @@ func (i *Installer) Install(seq runtime.Sequence) (err error) {
}
// Install the bootloader.
if !i.options.Bootloader {
return nil
}
var conf *grub.Config
if i.bootloader == nil {
conf = grub.NewConfig(i.cmdline.String())

View File

@ -88,10 +88,6 @@ func NewManifest(label string, sequence runtime.Sequence, bootPartitionFound boo
if err = VerifyEphemeralPartition(opts); err != nil {
return nil, fmt.Errorf("failed to prepare ephemeral partition: %w", err)
}
if err = VerifyBootPartition(opts); err != nil {
return nil, fmt.Errorf("failed to prepare boot partition: %w", err)
}
}
skipOverlayMountsCheck, err := shouldSkipOverlayMountsCheck(sequence)
@ -118,23 +114,19 @@ func NewManifest(label string, sequence runtime.Sequence, bootPartitionFound boo
efiTarget := EFITarget(opts.Disk, nil)
biosTarget := BIOSTarget(opts.Disk, nil)
var bootTarget *Target
if opts.Bootloader {
bootTarget = BootTarget(opts.Disk, &Target{
PreserveContents: bootPartitionFound,
Assets: []*Asset{
{
Source: fmt.Sprintf(constants.KernelAssetPath, opts.Arch),
Destination: filepath.Join(constants.BootMountPoint, label, constants.KernelAsset),
},
{
Source: fmt.Sprintf(constants.InitramfsAssetPath, opts.Arch),
Destination: filepath.Join(constants.BootMountPoint, label, constants.InitramfsAsset),
},
bootTarget := BootTarget(opts.Disk, &Target{
PreserveContents: bootPartitionFound,
Assets: []*Asset{
{
Source: fmt.Sprintf(constants.KernelAssetPath, opts.Arch),
Destination: filepath.Join(constants.BootMountPoint, label, constants.KernelAsset),
},
})
}
{
Source: fmt.Sprintf(constants.InitramfsAssetPath, opts.Arch),
Destination: filepath.Join(constants.BootMountPoint, label, constants.InitramfsAsset),
},
},
})
metaTarget := MetaTarget(opts.Disk, &Target{
PreserveContents: bootPartitionFound,

View File

@ -220,10 +220,9 @@ func (suite *manifestSuite) TestExecuteManifestClean() {
suite.skipUnderBuildkit()
manifest, err := install.NewManifest("A", runtime.SequenceInstall, false, &install.Options{
Disk: suite.loopbackDevice.Name(),
Bootloader: true,
Force: true,
Board: constants.BoardNone,
Disk: suite.loopbackDevice.Name(),
Force: true,
Board: constants.BoardNone,
})
suite.Require().NoError(err)
@ -241,10 +240,9 @@ func (suite *manifestSuite) TestExecuteManifestForce() {
suite.skipUnderBuildkit()
manifest, err := install.NewManifest("A", runtime.SequenceInstall, false, &install.Options{
Disk: suite.loopbackDevice.Name(),
Bootloader: true,
Force: true,
Board: constants.BoardNone,
Disk: suite.loopbackDevice.Name(),
Force: true,
Board: constants.BoardNone,
})
suite.Require().NoError(err)
@ -260,11 +258,10 @@ func (suite *manifestSuite) TestExecuteManifestForce() {
// reinstall
manifest, err = install.NewManifest("B", runtime.SequenceUpgrade, true, &install.Options{
Disk: suite.loopbackDevice.Name(),
Bootloader: true,
Force: true,
Zero: true,
Board: constants.BoardNone,
Disk: suite.loopbackDevice.Name(),
Force: true,
Zero: true,
Board: constants.BoardNone,
})
suite.Require().NoError(err)
@ -282,10 +279,9 @@ func (suite *manifestSuite) TestExecuteManifestPreserve() {
suite.skipUnderBuildkit()
manifest, err := install.NewManifest("A", runtime.SequenceInstall, false, &install.Options{
Disk: suite.loopbackDevice.Name(),
Bootloader: true,
Force: true,
Board: constants.BoardNone,
Disk: suite.loopbackDevice.Name(),
Force: true,
Board: constants.BoardNone,
})
suite.Require().NoError(err)
@ -301,10 +297,9 @@ func (suite *manifestSuite) TestExecuteManifestPreserve() {
// reinstall
manifest, err = install.NewManifest("B", runtime.SequenceUpgrade, true, &install.Options{
Disk: suite.loopbackDevice.Name(),
Bootloader: true,
Force: false,
Board: constants.BoardNone,
Disk: suite.loopbackDevice.Name(),
Force: false,
Board: constants.BoardNone,
})
suite.Require().NoError(err)

View File

@ -31,23 +31,6 @@ func VerifyEphemeralPartition(opts *Options) (err error) {
return nil
}
// VerifyBootPartition verifies the supplied boot device options.
func VerifyBootPartition(opts *Options) (err error) {
if opts.Bootloader {
return nil
}
if opts.Force {
return nil
}
if err = VerifyDiskAvailability(opts.Disk, constants.BootPartitionLabel); err != nil {
return fmt.Errorf("failed to verify disk availability: %w", err)
}
return nil
}
// VerifyDiskAvailability verifies that no filesystems currently exist with
// the labels used by the OS.
func VerifyDiskAvailability(devpath, label string) (err error) {

View File

@ -59,6 +59,13 @@ The predictable network interface names features can be disabled by specifying `
Talos automatically adds the `net.ifnames=0` kernel argument when upgrading from Talos versions before 1.5.
This change doesn't affect "cloud" platforms, like AWS, as Talos automatically adds `net.ifnames=0` to the kernel command line.
"""
[notes.machineconfig]
title = "Machine Config option `.machine.install.bootloader`"
description="""\
The `.machine.install.bootloader` option in the machine config is deprecated and will be removed in Talos 1.6.
This was a no-op for a long time. The bootloader is always installed.
"""
[make_deps]

View File

@ -44,7 +44,6 @@ func (in *Input) init() ([]config.Document, error) {
MachineInstall: &v1alpha1.InstallConfig{
InstallDisk: in.Options.InstallDisk,
InstallImage: in.Options.InstallImage,
InstallBootloader: pointer.To(true),
InstallWipe: pointer.To(false),
InstallExtraKernelArgs: in.Options.InstallExtraKernelArgs,
},

View File

@ -45,7 +45,6 @@ func (in *Input) worker() ([]config.Document, error) {
MachineInstall: &v1alpha1.InstallConfig{
InstallDisk: in.Options.InstallDisk,
InstallImage: in.Options.InstallImage,
InstallBootloader: pointer.To(true),
InstallWipe: pointer.To(false),
InstallExtraKernelArgs: in.Options.InstallExtraKernelArgs,
},

View File

@ -1208,7 +1208,11 @@ func (i *InstallConfig) LegacyBIOSSupport() bool {
// WithBootloader implements the config.Provider interface.
func (i *InstallConfig) WithBootloader() bool {
return pointer.SafeDeref(i.InstallBootloader)
if i.InstallBootloader == nil {
return true
}
return *i.InstallBootloader
}
// Image implements the config.Provider interface.

View File

@ -186,7 +186,6 @@ var (
InstallDisk: "/dev/sda",
InstallExtraKernelArgs: []string{"console=ttyS1", "panic=10"},
InstallImage: "ghcr.io/siderolabs/installer:latest",
InstallBootloader: pointer.To(true),
InstallWipe: pointer.To(false),
}

View File

@ -59,7 +59,6 @@ install:
- console=ttyS1
- panic=10
image: ghcr.io/siderolabs/installer:latest # Allows for supplying the image used to perform the installation.
bootloader: true # Indicates if a bootloader should be installed.
wipe: false # Indicates if the installation disk should be wiped at installation time.
# # Look up disk using disk attributes like model, size, serial and others.
@ -276,7 +275,6 @@ install:
- console=ttyS1
- panic=10
image: ghcr.io/siderolabs/installer:latest # Allows for supplying the image used to perform the installation.
bootloader: true # Indicates if a bootloader should be installed.
wipe: false # Indicates if the installation disk should be wiped at installation time.
# # Look up disk using disk attributes like model, size, serial and others.
@ -1096,7 +1094,6 @@ extraKernelArgs:
- console=ttyS1
- panic=10
image: ghcr.io/siderolabs/installer:latest # Allows for supplying the image used to perform the installation.
bootloader: true # Indicates if a bootloader should be installed.
wipe: false # Indicates if the installation disk should be wiped at installation time.
# # Look up disk using disk attributes like model, size, serial and others.