write files in system

This commit is contained in:
Mikaël Cluseau 2019-12-03 10:56:57 +01:00
parent 30c7462a62
commit eaa208fb6d
4 changed files with 18 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.*.sw[po]

View File

@ -1,8 +1,8 @@
# ------------------------------------------------------------------------
from mcluseau/golang-builder:1.13.1 as build
from mcluseau/golang-builder:1.13.4 as build
# ------------------------------------------------------------------------
from alpine:3.10
from alpine:3.10.3
env busybox_v=1.28.1-defconfig-multiarch \
arch=x86_64

View File

@ -1,5 +1,10 @@
package main
import (
nconfig "novit.nc/direktil/pkg/config"
)
type config struct {
Layers []string `yaml:"layers"`
Layers []string `yaml:"layers"`
Files []nconfig.FileDef `yaml:"files"`
}

View File

@ -127,6 +127,15 @@ func main() {
fatal("failed: ", err)
}
// - write files
for _, fileDef := range cfg.Files {
log.Print("writing ", fileDef.Path)
filePath := filepath.Join("/system", fileDef.Path)
ioutil.WriteFile(filePath, []byte(fileDef.Content), fileDef.Mode)
}
// clean zombies
cleanZombies()