diff --git a/build b/build index e349ab6..81572c9 100755 --- a/build +++ b/build @@ -19,29 +19,30 @@ go build -o $GOBIN/actool ${REPO_PATH}/app-container/actool echo "Building ACE validator..." GOOS=linux CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o $GOBIN/ace-validator ${REPO_PATH}/app-container/ace -echo "Building init (stage1)..." -go build -o $GOBIN/init ${REPO_PATH}/stage1 +if [[ "$OSTYPE" == "linux-gnu" ]]; then + echo "Building init (stage1)..." + go build -o $GOBIN/init ${REPO_PATH}/stage1 -S1BINS=${PWD}/stage0 -S1INIT=${S1BINS}/stage1_init -if [ $GOBIN/init -nt $S1INIT/bin.go ]; then - echo "Packaging init (stage1)..." - TMP=$(mktemp -d) - [ -d $S1INIT ] || mkdir -p $S1INIT - cp $GOBIN/init $TMP/s1init - go-bindata -o $S1INIT/bin.go -pkg="stage1_init" -prefix=$TMP $TMP + S1BINS=${PWD}/stage0 + S1INIT=${S1BINS}/stage1_init + if [ $GOBIN/init -nt $S1INIT/bin.go ]; then + echo "Packaging init (stage1)..." + TMP=$(mktemp -d) + [ -d $S1INIT ] || mkdir -p $S1INIT + cp $GOBIN/init $TMP/s1init + go-bindata -o $S1INIT/bin.go -pkg="stage1_init" -prefix=$TMP $TMP + fi + + S1ROOTFS=${S1BINS}/stage1_rootfs + if [ stage1/mkrootfs.sh -nt $S1ROOTFS/bin.go ]; then + echo "Generating and packaging rootfs (stage1)..." + [ -d "${S1ROOTFS}" ] || mkdir -p "${S1ROOTFS}" + pushd stage1 + OUTPUT=$S1ROOTFS/bin.go ./mkrootfs.sh + popd + fi fi -S1ROOTFS=${S1BINS}/stage1_rootfs -if [ stage1/mkrootfs.sh -nt $S1ROOTFS/bin.go ]; then - echo "Generating and packaging rootfs (stage1)..." - [ -d "${S1ROOTFS}" ] || mkdir -p "${S1ROOTFS}" - pushd stage1 - OUTPUT=$S1ROOTFS/bin.go ./mkrootfs.sh - popd -fi - - echo "Building rkt (stage0)..." go build -o $GOBIN/rkt ${REPO_PATH}/rkt diff --git a/rkt/run.go b/rkt/run_linux.go similarity index 99% rename from rkt/run.go rename to rkt/run_linux.go index a1c5913..d7b262a 100644 --- a/rkt/run.go +++ b/rkt/run_linux.go @@ -1,3 +1,5 @@ +//+build linux + package main import ( diff --git a/rkt/run_other.go b/rkt/run_other.go new file mode 100644 index 0000000..a3dc4de --- /dev/null +++ b/rkt/run_other.go @@ -0,0 +1,18 @@ +//+build !linux + +package main + +import "fmt" + +var ( + cmdRun = &Command{ + Name: "run", + Summary: "Run image(s) in an application container in rocket", + Run: runRun, + } +) + +func runRun(args []string) (exit int) { + fmt.Println("run is not implemented on this platform.") + return +} diff --git a/rkt/status.go b/rkt/status_linux.go similarity index 94% rename from rkt/status.go rename to rkt/status_linux.go index 696bf2d..5175003 100644 --- a/rkt/status.go +++ b/rkt/status_linux.go @@ -1,3 +1,5 @@ +//+build linux + package main import "fmt" diff --git a/rkt/status_other.go b/rkt/status_other.go new file mode 100644 index 0000000..e8647e8 --- /dev/null +++ b/rkt/status_other.go @@ -0,0 +1,18 @@ +//+build !linux + +package main + +import "fmt" + +var ( + cmdStatus = &Command{ + Name: "status", + Summary: "Check the status of a rkt job", + Run: runStatus, + } +) + +func runStatus(args []string) (exit int) { + fmt.Println("status is not implemented on this platform.") + return +} diff --git a/stage0/run.go b/stage0/run.go index 1a3b6d4..2003a1c 100644 --- a/stage0/run.go +++ b/stage0/run.go @@ -1,3 +1,5 @@ +//+build linux + package stage0 // diff --git a/stage1/container.go b/stage1/container.go index 11c84df..44d2472 100644 --- a/stage1/container.go +++ b/stage1/container.go @@ -1,3 +1,5 @@ +//+build linux + package main import ( diff --git a/stage1/init.go b/stage1/init.go index 88f9387..7d0c314 100644 --- a/stage1/init.go +++ b/stage1/init.go @@ -1,3 +1,5 @@ +//+build linux + package main // this implements /init of stage1/nspawn+systemd diff --git a/stage1/path.go b/stage1/path.go index 45fbc77..e587512 100644 --- a/stage1/path.go +++ b/stage1/path.go @@ -1,3 +1,5 @@ +//+build linux + package main import (