diff options
author | xengineering <me@xengineering.eu> | 2024-07-21 14:58:20 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-07-21 14:58:20 +0200 |
commit | 0db0ddcc421a5c2a85ac614d1f62e3e3374994a2 (patch) | |
tree | aa2a1e011cb94d4d20e1d4af3f7857d1163ade78 | |
parent | 1259c086a52f12a0a40650f2389d3401d9274144 (diff) | |
download | craft-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.
-rw-r--r-- | main.go | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 |