mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-25 16:41:12 +02:00
This modifies `osctl install` to use the provided userdata as the source for default installation values. This allows such things as userdata-supplied extra kernel parameters to be automatically included in the bootloader. Fixes #1102 Signed-off-by: Seán C McCord <ulexus@gmail.com>
25 lines
719 B
Go
25 lines
719 B
Go
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package userdata
|
|
|
|
import (
|
|
"strings"
|
|
|
|
ud "github.com/talos-systems/talos/pkg/userdata"
|
|
"github.com/talos-systems/talos/pkg/userdata/download"
|
|
)
|
|
|
|
// UserData provides an abstraction to call the appropriate method to
|
|
// load user data
|
|
// TODO: Merge this in to internal/pkg/userdata
|
|
func UserData(location string) (userData *ud.UserData, err error) {
|
|
if strings.HasPrefix(location, "http") {
|
|
userData, err = download.Download(location)
|
|
} else {
|
|
userData, err = ud.Open(location)
|
|
}
|
|
return userData, err
|
|
}
|