Merge pull request #99 from jodh-intel/image-require-systemd

Image require systemd
This commit is contained in:
James O. D. Hunt 2018-05-18 15:54:55 +01:00 committed by GitHub
commit a12618811d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 9 deletions

View File

@ -16,6 +16,9 @@ $ sudo ./image_builder.sh path/to/rootfs
Where `path/to/rootfs` is the directory populated by `rootfs.sh`.
> **Note**: If you are building an image from an Alpine rootfs, see
> the important note [here](rootfs-builder/README.md#rootfs-requirements).
## Further information
For more information about usage (including how to adjust the size of the

View File

@ -113,9 +113,19 @@ if [ -n "${USE_DOCKER}" ] ; then
exit $?
fi
# The kata rootfs image expect init and kata-agent to be installed
init="${ROOTFS}/sbin/init"
[ -x "${init}" ] || [ -L ${init} ] || die "/sbin/init is not installed in ${ROOTFS}"
init_path="/sbin/init"
init="${ROOTFS}${init_path}"
[ -x "${init}" ] || [ -L ${init} ] || die "${init_path} is not installed in ${ROOTFS}"
OK "init is installed"
if [ "${AGENT_INIT}" == "no" ]
then
systemd_path="/lib/systemd/systemd"
systemd="${ROOTFS}${systemd_path}"
[ -x "${systemd}" ] || [ -L ${systemd} ] || die "${systemd_path} is not installed in ${ROOTFS}"
OK "init is systemd"
fi
[ "${AGENT_INIT}" == "yes" ] || [ -x "${ROOTFS}/usr/bin/${AGENT_BIN}" ] || \
die "/usr/bin/${AGENT_BIN} is not installed in ${ROOTFS}
use AGENT_BIN env variable to change the expected agent binary name"

View File

@ -41,6 +41,9 @@ The rootfs must provide at least the following components:
When the `AGENT_INIT` environment variable is set to `yes`, use Kata agent as `/sbin/init`.
> **Note**: `AGENT_INIT=yes` **must** be used for the Alpine distribution
> since it does not use `systemd` as its init daemon.
## Creating a rootfs
To build a rootfs for your chosen distribution, run:

View File

@ -48,22 +48,26 @@ function build_initrd()
function build_rootfs_image_initrd()
{
distro="$1"
image="$2"
initrd="$3"
[ -n "$distro" ]
build_rootfs $distro
build_image
build_initrd
[ "$image" = "yes" ] && build_image
[ "$initrd" = "yes" ] && build_initrd
}
@test "Can create fedora image" {
build_rootfs_image_initrd fedora
build_rootfs_image_initrd fedora yes yes
}
@test "Can create clearlinux image" {
build_rootfs_image_initrd clearlinux
build_rootfs_image_initrd clearlinux yes yes
}
@test "Can create centos image" {
build_rootfs_image_initrd centos
build_rootfs_image_initrd centos yes yes
}
@test "Can create euleros image" {
@ -71,9 +75,9 @@ function build_rootfs_image_initrd()
then
skip "travis timeout, see: https://github.com/kata-containers/osbuilder/issues/46"
fi
build_rootfs_image_initrd euleros
build_rootfs_image_initrd euleros yes yes
}
@test "Can create alpine image" {
build_rootfs_image_initrd alpine
build_rootfs_image_initrd alpine no yes
}