From de6e4dc93f90a6ff8693e13045847f52040c7069 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 1 Feb 2018 01:12:32 +0800 Subject: [PATCH] builder: fix agent binary path kata agent is installed in `${ROOTFS}/usr/bin/` rather than `${ROOTFS}/bin/`. It just happended to work because `bin` is a symlink to `usr/bin`, which might not be true in some distros. So do not rely on it. Signed-off-by: Peng Tao --- image-builder/image_builder.sh | 4 ++-- initrd-builder/initrd_builder.sh | 4 ++-- rootfs-builder/rootfs.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/image-builder/image_builder.sh b/image-builder/image_builder.sh index 526967e16c..f79d583f54 100755 --- a/image-builder/image_builder.sh +++ b/image-builder/image_builder.sh @@ -138,8 +138,8 @@ fi init="${ROOTFS}/sbin/init" [ -x "${init}" ] || [ -L ${init} ] || die "/sbin/init is not installed in ${ROOTFS_DIR}" OK "init is installed" -[ "${AGENT_INIT}" == "yes" ] || [ -x "${ROOTFS}/bin/${AGENT_BIN}" ] || \ - die "/bin/${AGENT_BIN} is not installed in ${ROOTFS} +[ "${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" OK "Agent installed" [ "$(id -u)" -eq 0 ] || die "$0: must be run as root" diff --git a/initrd-builder/initrd_builder.sh b/initrd-builder/initrd_builder.sh index fbe435913b..a0bbc15d87 100755 --- a/initrd-builder/initrd_builder.sh +++ b/initrd-builder/initrd_builder.sh @@ -87,8 +87,8 @@ IMAGE_NAME=$(basename ${INITRD_IMAGE}) init="${ROOTFS}/sbin/init" [ -x "${init}" ] || [ -L ${init} ] || die "/sbin/init is not installed in ${ROOTFS_DIR}" OK "init is installed" -[ "${AGENT_INIT}" == "yes" ] || [ -x "${ROOTFS}/bin/${AGENT_BIN}" ] || \ - die "/bin/${AGENT_BIN} is not installed in ${ROOTFS} +[ "${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" OK "Agent is installed" diff --git a/rootfs-builder/rootfs.sh b/rootfs-builder/rootfs.sh index d9db308b71..248635c552 100755 --- a/rootfs-builder/rootfs.sh +++ b/rootfs-builder/rootfs.sh @@ -212,10 +212,10 @@ pushd "${GOPATH}/src/${GO_AGENT_PKG}" make INIT=${AGENT_INIT} make install DESTDIR="${ROOTFS_DIR}" INIT=${AGENT_INIT} popd -[ -x "${ROOTFS_DIR}/bin/${AGENT_BIN}" ] || die "/bin/${AGENT_BIN} is not installed in ${ROOTFS_DIR}" +[ -x "${ROOTFS_DIR}/usr/bin/${AGENT_BIN}" ] || die "/usr/bin/${AGENT_BIN} is not installed in ${ROOTFS_DIR}" OK "Agent installed" -[ "${AGENT_INIT}" == "yes" ] && setup_agent_init "${ROOTFS_DIR}/bin/${AGENT_BIN}" "${init}" +[ "${AGENT_INIT}" == "yes" ] && setup_agent_init "${ROOTFS_DIR}/usr/bin/${AGENT_BIN}" "${init}" info "Check init is installed" [ -x "${init}" ] || [ -L ${init} ] || die "/sbin/init is not installed in ${ROOTFS_DIR}"