Try 06
This commit is contained in:
parent
eb50773656
commit
1a180113cb
|
@ -43,8 +43,8 @@ func (hr *APKRepository) Delete() error {
|
|||
return err
|
||||
}
|
||||
lines := strings.Split(string(fileBytes), "\n")
|
||||
for i, line := range lines {
|
||||
|
||||
for _, line := range lines {
|
||||
fmt.Println(line)
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -18,7 +18,7 @@ func (hr *DebRepository) Add() error {
|
|||
//deb http://fr.archive.ubuntu.com/ubuntu/ focal main restricted
|
||||
|
||||
data := fmt.Sprintf("deb %s", hr.URL)
|
||||
if err := os.WriteFile("/etc/apt/source.list.d", []byte(data)); err != nil {
|
||||
if err := os.WriteFile("/etc/apt/source.list.d", []byte(data), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
|
@ -11,10 +13,29 @@ type Service struct {
|
|||
Vars map[string]interface{} `json:"Vars"`
|
||||
Daemons map[string]SystemService `json:"Daemons"`
|
||||
Users map[string]SystemUser `json:"Users"`
|
||||
Repos map[string]interface{} `json:"Repositories"`
|
||||
Packages map[string]SystemPackage `json:"Packages"`
|
||||
}
|
||||
|
||||
func (s *Service) manageRepo(repo interface{}) error {
|
||||
fmt.Printf("%v\n", repo)
|
||||
if repo["type"] == "helm" {
|
||||
var rp HelmRepository
|
||||
mapstructure.Decode(repo, rp)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Service) Manage(templateDir string) error {
|
||||
|
||||
for _, repo := range s.Repos {
|
||||
if err := s.manageRepo(repo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Manage system packages
|
||||
for _, pack := range s.Packages {
|
||||
err := pack.Manage()
|
||||
|
|
Loading…
Reference in New Issue