mirror of
https://github.com/digarok/Appy.git
synced 2024-11-26 06:49:19 +00:00
47 lines
952 B
Go
47 lines
952 B
Go
package core
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os/exec"
|
|
|
|
"github.com/digarok/appy/core/project"
|
|
)
|
|
|
|
const CadiusPath = "/usr/local/bin/cadius"
|
|
|
|
func CreateDisk(name string, file string, size string) {
|
|
fmt.Printf("Creating Disk: \"%s\" -> %s \tSize: %s\n", name, file, size)
|
|
|
|
cmd := exec.Command(CadiusPath, "CREATEVOLUME", file, name, size)
|
|
|
|
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)
|
|
cmd := exec.Command(CadiusPath, "ADDFILE", disk.File, file.Output, file.Input)
|
|
err := cmd.Run()
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
func BuildDisk() {
|
|
var p = project.AppyProj
|
|
for _, disk := range p.Disks {
|
|
CreateDisk(disk.Name, disk.File, disk.Size)
|
|
AddFiles(disk)
|
|
}
|
|
}
|