diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-12-16 11:38:54 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-12-23 09:31:27 +0200 |
commit | c28033e3ef511a56d57b3424cf38e8987902bec8 (patch) | |
tree | fcffb2aa04f231a121a1fb82f16b8442c9a1b665 | |
parent | ebcb03f6313bee21b03f481b955f40537a250afd (diff) | |
download | ambient-build-vm-c28033e3ef511a56d57b3424cf38e8987902bec8.tar.gz |
feat: add script to "boot strap" a CI run
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
-rwxr-xr-x | ambient-boot | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ambient-boot b/ambient-boot new file mode 100755 index 0000000..c00e50c --- /dev/null +++ b/ambient-boot @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Boot strap running Ambient CI in a VM built for Ambient. Read a tar +# archive from the specified device, and extract it into a temporary +# directory. Then run the executable "run-ci" that's in that +# directory. The executable can then do the rest of the work to +# execute a CI run. + +set -eu + +die() { + echo "ERROR: $*" 1>&2 + exit 1 +} + +log() { + echo "INFO: $*" +} + +if [ "$#" != 1 ]; then + die "usage: $0 /dev/vdx" +fi + +dev="$1" + +case "$dev" in +/*) true ;; +*) die "Argument MUST be an absolute path name" ;; +esac + +tmp="$(mktemp -d)" + +cd "$tmp" +log "Extracting tar archive from $dev" +tar -xvf "$dev" +echo +log "Running run-ci from $dev" +echo ================================ BEGIN ================================ +if ./run-ci; then + echo "EXIT CODE: 0" +else + echo "EXIT CODE: $?" +fi |