mirror of
https://github.com/rancher/os.git
synced 2025-09-18 08:06:48 +00:00
Move around code for better clarity
This commit is contained in:
committed by
niusmallnan
parent
2f50b7b178
commit
1f50386828
41
pkg/init/prepare/prepare.go
Normal file
41
pkg/init/prepare/prepare.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package prepare
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/pkg/dfs"
|
||||
"github.com/rancher/os/pkg/log"
|
||||
)
|
||||
|
||||
var (
|
||||
mountConfig = dfs.Config{
|
||||
CgroupHierarchy: map[string]string{
|
||||
"cpu": "cpu",
|
||||
"cpuacct": "cpu",
|
||||
"net_cls": "net_cls",
|
||||
"net_prio": "net_cls",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func FS(c *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
return c, dfs.PrepareFs(&mountConfig)
|
||||
}
|
||||
|
||||
func SaveCmdline(c *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
// the Kernel Patch added for RancherOS passes `--` (only) elided kernel boot params to the init process
|
||||
cmdLineArgs := strings.Join(os.Args, " ")
|
||||
config.SaveInitCmdline(cmdLineArgs)
|
||||
|
||||
cfg := config.LoadConfig()
|
||||
log.Debugf("Cmdline debug = %t", cfg.Rancher.Debug)
|
||||
if cfg.Rancher.Debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
Reference in New Issue
Block a user