mirror of
https://github.com/mudler/luet.git
synced 2025-09-19 01:10:58 +00:00
Add option config_from_host
This commit is contained in:
@@ -69,6 +69,7 @@
|
|||||||
# Default $TMPDIR/tmpluet
|
# Default $TMPDIR/tmpluet
|
||||||
# tmpdir_base: "/tmp/tmpluet"
|
# tmpdir_base: "/tmp/tmpluet"
|
||||||
#
|
#
|
||||||
|
#
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
# Repositories configurations directories.
|
# Repositories configurations directories.
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
@@ -93,6 +94,11 @@
|
|||||||
# annotation.
|
# annotation.
|
||||||
# config_protect_skip: false
|
# config_protect_skip: false
|
||||||
#
|
#
|
||||||
|
# The paths used for load repositories and config
|
||||||
|
# protects are based on host rootfs.
|
||||||
|
# If set to false rootfs path is used as prefix.
|
||||||
|
# config_from_host: true
|
||||||
|
#
|
||||||
# System repositories
|
# System repositories
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
# In alternative to define repositories files
|
# In alternative to define repositories files
|
||||||
|
@@ -208,6 +208,7 @@ type LuetConfig struct {
|
|||||||
RepositoriesConfDir []string `mapstructure:"repos_confdir"`
|
RepositoriesConfDir []string `mapstructure:"repos_confdir"`
|
||||||
ConfigProtectConfDir []string `mapstructure:"config_protect_confdir"`
|
ConfigProtectConfDir []string `mapstructure:"config_protect_confdir"`
|
||||||
ConfigProtectSkip bool `mapstructure:"config_protect_skip"`
|
ConfigProtectSkip bool `mapstructure:"config_protect_skip"`
|
||||||
|
ConfigFromHost bool `mapstructure:"config_from_host"`
|
||||||
CacheRepositories []LuetRepository `mapstructure:"repetitors"`
|
CacheRepositories []LuetRepository `mapstructure:"repetitors"`
|
||||||
SystemRepositories []LuetRepository `mapstructure:"repositories"`
|
SystemRepositories []LuetRepository `mapstructure:"repositories"`
|
||||||
|
|
||||||
@@ -255,6 +256,8 @@ func GenDefault(viper *v.Viper) {
|
|||||||
viper.SetDefault("repos_confdir", []string{"/etc/luet/repos.conf.d"})
|
viper.SetDefault("repos_confdir", []string{"/etc/luet/repos.conf.d"})
|
||||||
viper.SetDefault("config_protect_confdir", []string{"/etc/luet/config.protect.d"})
|
viper.SetDefault("config_protect_confdir", []string{"/etc/luet/config.protect.d"})
|
||||||
viper.SetDefault("config_protect_skip", false)
|
viper.SetDefault("config_protect_skip", false)
|
||||||
|
// TODO: Set default to false when we are ready for migration.
|
||||||
|
viper.SetDefault("config_from_host", true)
|
||||||
viper.SetDefault("cache_repositories", []string{})
|
viper.SetDefault("cache_repositories", []string{})
|
||||||
viper.SetDefault("system_repositories", []string{})
|
viper.SetDefault("system_repositories", []string{})
|
||||||
|
|
||||||
|
@@ -30,11 +30,16 @@ import (
|
|||||||
|
|
||||||
func LoadConfigProtectConfs(c *LuetConfig) error {
|
func LoadConfigProtectConfs(c *LuetConfig) error {
|
||||||
var regexConfs = regexp.MustCompile(`.yml$`)
|
var regexConfs = regexp.MustCompile(`.yml$`)
|
||||||
|
var err error
|
||||||
|
|
||||||
|
rootfs := ""
|
||||||
|
|
||||||
// Respect the rootfs param on read repositories
|
// Respect the rootfs param on read repositories
|
||||||
rootfs, err := c.GetSystem().GetRootFsAbs()
|
if !c.ConfigFromHost {
|
||||||
if err != nil {
|
rootfs, err = c.GetSystem().GetRootFsAbs()
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cdir := range c.ConfigProtectConfDir {
|
for _, cdir := range c.ConfigProtectConfDir {
|
||||||
|
@@ -30,11 +30,15 @@ import (
|
|||||||
|
|
||||||
func LoadRepositories(c *LuetConfig) error {
|
func LoadRepositories(c *LuetConfig) error {
|
||||||
var regexRepo = regexp.MustCompile(`.yml$|.yaml$`)
|
var regexRepo = regexp.MustCompile(`.yml$|.yaml$`)
|
||||||
|
var err error
|
||||||
|
rootfs := ""
|
||||||
|
|
||||||
// Respect the rootfs param on read repositories
|
// Respect the rootfs param on read repositories
|
||||||
rootfs, err := c.GetSystem().GetRootFsAbs()
|
if !c.ConfigFromHost {
|
||||||
if err != nil {
|
rootfs, err = c.GetSystem().GetRootFsAbs()
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, rdir := range c.RepositoriesConfDir {
|
for _, rdir := range c.RepositoriesConfDir {
|
||||||
|
Reference in New Issue
Block a user