mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
rootfs-builder: fix unbootable dracut-based initramfs on Fedora
This is a forward port of Kata 1.x PR's https://github.com/kata-containers/osbuilder/pull/480 and https://github.com/kata-containers/osbuilder/pull/494 . Fixes #646 Signed-off-by: Pavel Mores <pmores@redhat.com>
This commit is contained in:
parent
fcfe00369b
commit
2dfb8bc549
@ -186,14 +186,20 @@ check_rootfs() {
|
|||||||
OK "init is installed"
|
OK "init is installed"
|
||||||
|
|
||||||
|
|
||||||
systemd_path="/lib/systemd/systemd"
|
candidate_systemd_paths="/usr/lib/systemd/systemd /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")
|
||||||
if [ ! -x "${systemd}" ] && [ ! -L "${systemd}" ]; then
|
for systemd_path in $candidate_systemd_paths; do
|
||||||
error "${systemd_path} is not installed in ${rootfs}"
|
systemd="${rootfs}${systemd_path}"
|
||||||
|
if [ -x "${systemd}" ] || [ -L "${systemd}" ]; then
|
||||||
|
found="yes"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ ! $found ]; then
|
||||||
|
error "None of ${candidate_systemd_paths} is installed in ${rootfs}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
OK "init is systemd"
|
OK "init is systemd"
|
||||||
@ -207,10 +213,13 @@ check_rootfs() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# checksum must be different to system
|
# checksum must be different to system
|
||||||
if [ -f "${systemd}" ] && cmp -s "${systemd}" "${agent}"; then
|
for systemd_path in $candidate_systemd_paths; do
|
||||||
error "The agent is not the init process. ${agent_path} is systemd"
|
systemd="${rootfs}${systemd_path}"
|
||||||
return 1
|
if [ -f "${systemd}" ] && cmp -s "${systemd}" "${agent}"; then
|
||||||
fi
|
error "The agent is not the init process. ${agent_path} is systemd"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
OK "Agent installed"
|
OK "Agent installed"
|
||||||
;;
|
;;
|
||||||
|
@ -441,8 +441,7 @@ prepare_overlay()
|
|||||||
# we were passed a pre-populated rootfs directory
|
# we were passed a pre-populated rootfs directory
|
||||||
if [ ! -e ./sbin/init ]; then
|
if [ ! -e ./sbin/init ]; then
|
||||||
ln -sf ./usr/lib/systemd/systemd ./init
|
ln -sf ./usr/lib/systemd/systemd ./init
|
||||||
ln -sf ../../init ./lib/systemd/systemd
|
ln -sf /init ./sbin/init
|
||||||
ln -sf ../init ./sbin/init
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kata systemd unit file
|
# Kata systemd unit file
|
||||||
|
Loading…
Reference in New Issue
Block a user