some bug fixes, manifest.toml don't exist anyomre and all data for installation will be in one file name Packet.lua
This commit is contained in:
44
internal/build/manager.go
Normal file
44
internal/build/manager.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"os"
|
||||
"packets/configs"
|
||||
"packets/internal/consts"
|
||||
"packets/internal/utils"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
func (container Container) createNew() error {
|
||||
if err := os.MkdirAll(filepath.Join(consts.BuildImagesDir, string(container.BuildID)), 0775); err != nil {
|
||||
return err
|
||||
}
|
||||
packetsuid, err := utils.GetPacketsUID()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chown(filepath.Join(consts.BuildImagesDir, string(container.BuildID)), packetsuid, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
dependencies, err := utils.ResolvDependencies(container.Manifest.Build.BuildDependencies)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cfg, err := configs.GetConfigTOML()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var wg sync.WaitGroup
|
||||
var mu sync.Mutex
|
||||
for _, depn := range dependencies {
|
||||
wg.Add(1)
|
||||
go container.asyncFullInstallDependencie(depn, cfg.Config.StorePackages, depn, &wg, &mu)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
container.saveBuild()
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user