From 0db0ddcc421a5c2a85ac614d1f62e3e3374994a2 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 21 Jul 2024 14:58:20 +0200 Subject: 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. --- main.go | 10 ++++++---- 1 file 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 -- cgit v1.2.3-70-g09d2