#!/bin/bash

# Set the working directory to the script's directory
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P)
cd $script_dir

# Install ginkgo
go get github.com/onsi/ginkgo/ginkgo

# Install runc
go get -d github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
git checkout 3f2f8b84a77f73d38244dd690525642a72156c64
go install github.com/opencontainers/runc
cd $script_dir

# Generate busybox rootfs directory for runC tests
rootfs=runtime/runc/testbundle/rootfs
mkdir --parents $rootfs
sudo docker export $(sudo docker create busybox) | tar -C $rootfs -xvf - > /dev/null
