mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 11:31:05 +00:00
image-builder: remove unneeded systemd units and files
Remove systemd units and files that are not needed in Kata Containers. Removing this files we can improve the boot time. fixes #289 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
4a2fa6875d
commit
02b3b3b977
@ -7,4 +7,4 @@ From fedora:latest
|
||||
|
||||
RUN [ -n "$http_proxy" ] && sed -i '$ a proxy='$http_proxy /etc/dnf/dnf.conf ; true
|
||||
|
||||
RUN dnf install -y qemu-img parted gdisk e2fsprogs gcc xfsprogs
|
||||
RUN dnf install -y qemu-img parted gdisk e2fsprogs gcc xfsprogs findutils
|
||||
|
@ -34,6 +34,31 @@ readonly dax_header_sz=2
|
||||
# [2] - https://nvdimm.wiki.kernel.org/2mib_fs_dax
|
||||
readonly dax_alignment=2
|
||||
|
||||
# The list of systemd units and files that are not needed in Kata Containers
|
||||
readonly -a systemd_units=(
|
||||
"systemd-coredump@"
|
||||
"systemd-journald"
|
||||
"systemd-journald-dev-log"
|
||||
"systemd-journal-flush"
|
||||
"systemd-random-seed"
|
||||
"systemd-timesyncd"
|
||||
"systemd-tmpfiles-setup"
|
||||
"systemd-udevd"
|
||||
"systemd-udevd-control"
|
||||
"systemd-udevd-kernel"
|
||||
"systemd-udev-trigger"
|
||||
"systemd-update-utmp"
|
||||
)
|
||||
|
||||
readonly -a systemd_files=(
|
||||
"systemd-bless-boot-generator"
|
||||
"systemd-fstab-generator"
|
||||
"systemd-getty-generator"
|
||||
"systemd-gpt-auto-generator"
|
||||
"systemd-tmpfiles-cleanup.timer"
|
||||
"tmp.mount"
|
||||
)
|
||||
|
||||
# Set a default value
|
||||
AGENT_INIT=${AGENT_INIT:-no}
|
||||
|
||||
@ -344,6 +369,19 @@ create_rootfs_image() {
|
||||
sync
|
||||
OK "rootfs copied"
|
||||
|
||||
info "Removing unneeded systemd services and sockets"
|
||||
for u in "${systemd_units[@]}"; do
|
||||
find "${mount_dir}" -type f \( \
|
||||
-name "${u}.service" -o \
|
||||
-name "${u}.socket" \) \
|
||||
-exec rm -f {} \;
|
||||
done
|
||||
|
||||
info "Removing unneeded systemd files"
|
||||
for u in "${systemd_files[@]}"; do
|
||||
find "${mount_dir}" -type f -name "${u}" -exec rm -f {} \;
|
||||
done
|
||||
|
||||
info "Unmounting root partition"
|
||||
umount "${mount_dir}"
|
||||
OK "Root partition unmounted"
|
||||
|
Loading…
Reference in New Issue
Block a user