2021-04-26 12:50:38 +00:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os/exec"
|
|
|
|
|
|
|
|
"github.com/digarok/appy/core/project"
|
|
|
|
)
|
|
|
|
|
|
|
|
func CreateDisk(name string, file string, size string) {
|
|
|
|
fmt.Printf("Creating Disk: \"%s\" -> %s \tSize: %s\n", name, file, size)
|
|
|
|
|
2021-11-25 14:53:44 +00:00
|
|
|
cmd := exec.Command(project.LocalConf.Programs.Cadius, "CREATEVOLUME", file, name, size)
|
2021-04-26 12:50:38 +00:00
|
|
|
err := cmd.Run()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func AddFiles(disk project.Disk) {
|
|
|
|
fmt.Printf("Add files to: \"%s\"\n", disk.Name)
|
|
|
|
for _, file := range disk.Files {
|
|
|
|
// fmt.Printf("%s ADDFILE %s %s %s\n", CadiusPath, disk.File, file.Output, file.Input)
|
|
|
|
fmt.Printf(" Adding file: -----> %s\n", file.Input)
|
2021-11-25 15:07:11 +00:00
|
|
|
|
2021-11-25 14:53:44 +00:00
|
|
|
cmd := exec.Command(project.LocalConf.Programs.Cadius, "ADDFILE", disk.File, file.Output, file.Input)
|
2021-04-26 12:50:38 +00:00
|
|
|
err := cmd.Run()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BuildDisk() {
|
2021-11-25 15:07:11 +00:00
|
|
|
for _, disk := range project.AppyProj.Disks {
|
2021-04-26 12:50:38 +00:00
|
|
|
CreateDisk(disk.Name, disk.File, disk.Size)
|
|
|
|
AddFiles(disk)
|
|
|
|
}
|
|
|
|
}
|