summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-07-21 14:58:20 +0200
committerxengineering <me@xengineering.eu>2024-07-21 14:58:20 +0200
commit0db0ddcc421a5c2a85ac614d1f62e3e3374994a2 (patch)
treeaa2a1e011cb94d4d20e1d4af3f7857d1163ade78 /main.go
parent1259c086a52f12a0a40650f2389d3401d9274144 (diff)
downloadcraft-0db0ddcc421a5c2a85ac614d1f62e3e3374994a2.tar
craft-0db0ddcc421a5c2a85ac614d1f62e3e3374994a2.tar.zst
craft-0db0ddcc421a5c2a85ac614d1f62e3e3374994a2.zip
Remove craft.sh concept / add --task argument
There will likely be a way how a source repository can specify the default shell commands to build itself for craft. If this will be a pure shell file, YAML, JSON or something else is not clear for now. This commit removes the lookup of the craft.sh file and instead adds the --task command line argument to specify that script code. This might only be a temporary solution but is the best fit for now.
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.go b/main.go
index 301fca2..913b5b5 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"bytes"
"flag"
+ "fmt"
"log"
"os"
"os/exec"
@@ -13,11 +14,13 @@ import (
var (
repo = ""
commit = ""
+ task = ""
)
func init() {
flag.StringVar(&repo, "repo", "", "Source code as valid Git URL")
flag.StringVar(&commit, "commit", "", "Commit or commit-ish reference for checkout")
+ flag.StringVar(&task, "task", "", "Shell code to execute for the build")
}
func main() {
@@ -46,11 +49,10 @@ func runCommand(dir string, name string, args ...string) {
}
func craft(workbench string) {
- script := `#!/bin/sh
+ script := fmt.Sprintf(`#!/bin/sh
-source craft.sh
-build
-`
+%s
+`, task)
cmd := exec.Command("busybox", "ash")
cmd.Dir = workbench