2019-12-27 19:12:08 +00:00
|
|
|
// Copyright © 2019 Ettore Di Giacinto <mudler@gentoo.org>
|
|
|
|
// Daniele Rondina <geaaru@sabayonlinux.org>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
config "github.com/mudler/luet/pkg/config"
|
2020-06-06 08:36:42 +00:00
|
|
|
installer "github.com/mudler/luet/pkg/installer"
|
2019-12-27 19:12:08 +00:00
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var configCmd = &cobra.Command{
|
2020-05-10 18:24:08 +00:00
|
|
|
Use: "config",
|
|
|
|
Short: "Print config",
|
|
|
|
Long: `Show luet configuration`,
|
|
|
|
Aliases: []string{"c"},
|
2019-12-27 19:12:08 +00:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
fmt.Println(config.LuetCfg.GetLogging())
|
|
|
|
fmt.Println(config.LuetCfg.GetGeneral())
|
2019-12-30 20:56:13 +00:00
|
|
|
fmt.Println(config.LuetCfg.GetSystem())
|
2019-12-27 19:12:08 +00:00
|
|
|
if len(config.LuetCfg.CacheRepositories) > 0 {
|
2020-01-02 17:38:07 +00:00
|
|
|
fmt.Println("repetitors:")
|
2019-12-27 19:12:08 +00:00
|
|
|
for _, r := range config.LuetCfg.CacheRepositories {
|
|
|
|
fmt.Println(" - ", r.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(config.LuetCfg.SystemRepositories) > 0 {
|
2020-01-02 17:38:07 +00:00
|
|
|
fmt.Println("repositories:")
|
2019-12-27 19:12:08 +00:00
|
|
|
for _, r := range config.LuetCfg.SystemRepositories {
|
|
|
|
fmt.Println(" - ", r.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(config.LuetCfg.RepositoriesConfDir) > 0 {
|
|
|
|
fmt.Println("repos_confdir:")
|
|
|
|
for _, dir := range config.LuetCfg.RepositoriesConfDir {
|
|
|
|
fmt.Println(" - ", dir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-06 08:36:42 +00:00
|
|
|
if len(config.LuetCfg.ConfigProtectConfDir) > 0 {
|
|
|
|
|
|
|
|
// Load config protect configs
|
|
|
|
installer.LoadConfigProtectConfs(config.LuetCfg)
|
|
|
|
|
|
|
|
fmt.Println("config_protect_confdir:")
|
|
|
|
for _, dir := range config.LuetCfg.ConfigProtectConfDir {
|
|
|
|
fmt.Println(" - ", dir)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(config.LuetCfg.GetConfigProtectConfFiles()) > 0 {
|
|
|
|
fmt.Println("protect_conf_files:")
|
|
|
|
for _, file := range config.LuetCfg.GetConfigProtectConfFiles() {
|
|
|
|
fmt.Println(" - ", file.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-27 19:12:08 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
RootCmd.AddCommand(configCmd)
|
|
|
|
}
|