mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-12 13:22:28 +00:00
Merge pull request #99 from jodh-intel/image-require-systemd
Image require systemd
This commit is contained in:
commit
a12618811d
@ -16,6 +16,9 @@ $ sudo ./image_builder.sh path/to/rootfs
|
|||||||
|
|
||||||
Where `path/to/rootfs` is the directory populated by `rootfs.sh`.
|
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
|
## Further information
|
||||||
|
|
||||||
For more information about usage (including how to adjust the size of the
|
For more information about usage (including how to adjust the size of the
|
||||||
|
@ -113,9 +113,19 @@ if [ -n "${USE_DOCKER}" ] ; then
|
|||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
# The kata rootfs image expect init and kata-agent to be installed
|
# The kata rootfs image expect init and kata-agent to be installed
|
||||||
init="${ROOTFS}/sbin/init"
|
init_path="/sbin/init"
|
||||||
[ -x "${init}" ] || [ -L ${init} ] || die "/sbin/init is not installed in ${ROOTFS}"
|
init="${ROOTFS}${init_path}"
|
||||||
|
[ -x "${init}" ] || [ -L ${init} ] || die "${init_path} is not installed in ${ROOTFS}"
|
||||||
OK "init is installed"
|
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}" ] || \
|
[ "${AGENT_INIT}" == "yes" ] || [ -x "${ROOTFS}/usr/bin/${AGENT_BIN}" ] || \
|
||||||
die "/usr/bin/${AGENT_BIN} is not installed in ${ROOTFS}
|
die "/usr/bin/${AGENT_BIN} is not installed in ${ROOTFS}
|
||||||
use AGENT_BIN env variable to change the expected agent binary name"
|
use AGENT_BIN env variable to change the expected agent binary name"
|
||||||
|
@ -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`.
|
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
|
## Creating a rootfs
|
||||||
|
|
||||||
To build a rootfs for your chosen distribution, run:
|
To build a rootfs for your chosen distribution, run:
|
||||||
|
@ -48,22 +48,26 @@ function build_initrd()
|
|||||||
function build_rootfs_image_initrd()
|
function build_rootfs_image_initrd()
|
||||||
{
|
{
|
||||||
distro="$1"
|
distro="$1"
|
||||||
|
image="$2"
|
||||||
|
initrd="$3"
|
||||||
|
|
||||||
[ -n "$distro" ]
|
[ -n "$distro" ]
|
||||||
build_rootfs $distro
|
build_rootfs $distro
|
||||||
build_image
|
|
||||||
build_initrd
|
[ "$image" = "yes" ] && build_image
|
||||||
|
[ "$initrd" = "yes" ] && build_initrd
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Can create fedora image" {
|
@test "Can create fedora image" {
|
||||||
build_rootfs_image_initrd fedora
|
build_rootfs_image_initrd fedora yes yes
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Can create clearlinux image" {
|
@test "Can create clearlinux image" {
|
||||||
build_rootfs_image_initrd clearlinux
|
build_rootfs_image_initrd clearlinux yes yes
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Can create centos image" {
|
@test "Can create centos image" {
|
||||||
build_rootfs_image_initrd centos
|
build_rootfs_image_initrd centos yes yes
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Can create euleros image" {
|
@test "Can create euleros image" {
|
||||||
@ -71,9 +75,9 @@ function build_rootfs_image_initrd()
|
|||||||
then
|
then
|
||||||
skip "travis timeout, see: https://github.com/kata-containers/osbuilder/issues/46"
|
skip "travis timeout, see: https://github.com/kata-containers/osbuilder/issues/46"
|
||||||
fi
|
fi
|
||||||
build_rootfs_image_initrd euleros
|
build_rootfs_image_initrd euleros yes yes
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Can create alpine image" {
|
@test "Can create alpine image" {
|
||||||
build_rootfs_image_initrd alpine
|
build_rootfs_image_initrd alpine no yes
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user