summaryrefslogtreecommitdiff
path: root/ambient-boot
blob: c00e50cb119bc86ac82347c376eaeabe0a6be12c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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