Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rootfs: delete more systemd files #302

Open
wants to merge 20 commits into
base: msft-main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions tools/osbuilder/rootfs-builder/rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,62 @@ TARGET_OS=${TARGET_OS:-linux}

# The list of systemd units and files that are not needed in Kata Containers
readonly -a systemd_units=(
"blk-availability"
"sys-fs-fuse-connections"
"sys-kernel-config"
"systemd-ask-password-console"
"systemd-ask-password-wall"
"systemd-boot-update"
"systemd-coredump@"
"systemd-journal-catalog-update"
"systemd-journal-flush"
"systemd-journald"
"systemd-journald@"
"systemd-journald-audit"
"systemd-journald-dev-log"
"systemd-journal-flush"
"systemd-logind"
"systemd-network-generator"
"systemd-pcrfs@"
"systemd-pcrfs-root"
"systemd-pcrlock-firmware-code"
"systemd-pcrlock-firmware-config"
"systemd-pcrlock-file-system"
"systemd-pcrlock-machine-id"
"systemd-pcrlock-make-policy"
"systemd-pcrlock-secureboot-authority"
"systemd-pcrlock-secureboot-policy"
"systemd-pcrmachine"
"systemd-pcrphase"
"systemd-pcrphase-initrd"
"systemd-pcrphase-sysinit"
"systemd-pcrextend"
"systemd-pcrextend@"
"systemd-pstore"
"systemd-random-seed"
"systemd-sysupdate"
"systemd-sysupdate-reboot"
"systemd-timesyncd"
"systemd-tmpfiles-clean"
"systemd-tmpfiles-setup"
"systemd-tmpfiles-setup-dev"
"systemd-tmpfiles-setup-dev-early"
"systemd-tpm2-setup"
"systemd-tpm2-setup-early"
"systemd-update-utmp"
"systemd-update-utmp-runlevel"
"systemd-vconsole-setup"
)

readonly -a systemd_files=(
"blkdeactivate"
"journalctl"
"systemd-bless-boot-generator"
"systemd-fstab-generator"
"systemd-getty-generator"
"systemd-gpt-auto-generator"
"systemd-tmpfiles-cleanup.timer"
"systemd-pcrlock"
"systemd-tmpfiles"
"systemd-tty-ask-password-agent"
)

handle_error() {
Expand Down Expand Up @@ -745,11 +785,16 @@ detect_host_distro()

delete_unnecessary_files()
{
info "Removing unneeded systemd services and sockets"
info "Removing unneeded systemd unit files"
for u in "${systemd_units[@]}"; do
find "${ROOTFS_DIR}" \
\( -type f -o -type l \) \
\( -name "${u}.service" -o -name "${u}.socket" \) \
\( -name "${u}" -o \
-name "${u}.mount" -o \
-name "${u}.path" -o \
-name "${u}.service" -o \
-name "${u}.socket" -o \
-name "${u}.timer" \) \
-exec echo "deleting {}" \; \
-exec rm -f {} \;
done
Expand Down
Loading