Seán C McCord 47a361c5b6 fix(osctl): use real userdata as defaults for install
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>
2019-09-08 17:00:12 -07:00

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
}