mirror of
https://github.com/clearlinux/rkt.git
synced 2026-08-23 07:45:56 +00:00
*: build a limited version of rkt on non-Linux
This introduces build tags to allow the actual rkt binary to be built on platforms other than Linux. This does not change our current focus of rocket being targeted at the Linux/amd64 platform, but means that users on e.g. OS X and other operating systems can at least use `rkt fetch` to retrieve ACI images and so forth.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package stage0
|
||||
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
// this implements /init of stage1/nspawn+systemd
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//+build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user