mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
image-builder: check /sbin/init when AGENT_INIT=yes
kata-agent is moved to /sbin/init when AGENT_INIT is yes. Check /sbin/init exists and it's not systemd fixes #322 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
73cee17420
commit
b1b8ce427a
@ -180,11 +180,12 @@ check_rootfs() {
|
|||||||
OK "init is installed"
|
OK "init is installed"
|
||||||
|
|
||||||
|
|
||||||
|
systemd_path="/lib/systemd/systemd"
|
||||||
|
systemd="${rootfs}${systemd_path}"
|
||||||
|
|
||||||
# check agent or systemd
|
# check agent or systemd
|
||||||
case "${AGENT_INIT}" in
|
case "${AGENT_INIT}" in
|
||||||
"no")
|
"no")
|
||||||
systemd_path="/lib/systemd/systemd"
|
|
||||||
systemd="${rootfs}${systemd_path}"
|
|
||||||
if [ ! -x "${systemd}" ] && [ ! -L "${systemd}" ]; then
|
if [ ! -x "${systemd}" ] && [ ! -L "${systemd}" ]; then
|
||||||
error "${systemd_path} is not installed in ${rootfs}"
|
error "${systemd_path} is not installed in ${rootfs}"
|
||||||
return 1
|
return 1
|
||||||
@ -193,12 +194,18 @@ check_rootfs() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"yes")
|
"yes")
|
||||||
agent_path="/usr/bin/${AGENT_BIN}"
|
agent_path="/sbin/init"
|
||||||
agent="${rootfs}${agent_path}"
|
agent="${rootfs}${agent_path}"
|
||||||
if [ ! -x "${agent}" ]; then
|
if [ ! -x "${agent}" ]; then
|
||||||
error "${agent_path} is not installed in ${rootfs}. Use AGENT_BIN env variable to change the expected agent binary name"
|
error "${agent_path} is not installed in ${rootfs}. Use AGENT_BIN env variable to change the expected agent binary name"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
# checksum must be different to system
|
||||||
|
if [ -f "${systemd}" ] && cmp -s "${systemd}" "${agent}"; then
|
||||||
|
error "The agent is not the init process. ${agent_path} is systemd"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
OK "Agent installed"
|
OK "Agent installed"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user