Merge pull request #11126 from gkurz/rootfs-systemd-files

rootfs: Don't remove files from the rootfs by default
This commit is contained in:
Aurélien Bombo 2025-04-22 18:17:14 +01:00 committed by GitHub
commit 318c409ed6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -93,7 +93,7 @@ rootfs-%: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX)
.PRECIOUS: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX)
$(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX):: rootfs-builder/%
$(call silent_run,Creating rootfs for "$*",$(ROOTFS_BUILDER) -o $(VERSION_COMMIT) -r $(ROOTFS_BUILD_DEST)/$*_rootfs $*)
$(call silent_run,Creating rootfs for "$*",$(ROOTFS_BUILDER) -o $(VERSION_COMMIT) -d -r $(ROOTFS_BUILD_DEST)/$*_rootfs $*)
@touch $@
# To generate a dracut rootfs, we first generate a dracut initrd and then

View File

@ -106,6 +106,8 @@ readonly -a systemd_files=(
"systemd-tmpfiles-cleanup.timer"
)
typeset should_delete_unnecessary_files="no"
handle_error() {
local exit_code="${?}"
local line_number="${1:-}"
@ -158,6 +160,7 @@ $(get_distros | tr "\n" " ")
Options:
-a <version> Specify the agent version. Overrides the AGENT_VERSION
environment variable.
-d Delete unnecessary systemd units and files
-h Show this help message.
-l List the supported Linux distributions and exit immediately.
-o <version> Specify the version of osbuilder to embed in the rootfs
@ -818,7 +821,9 @@ EOF
info "Create /etc/resolv.conf file in rootfs if not exist"
touch "$dns_file"
delete_unnecessary_files
if [[ "${should_delete_unnecessary_files}" == "yes" ]]; then
delete_unnecessary_files
fi
info "Creating summary file"
create_summary_file "${ROOTFS_DIR}"
@ -828,10 +833,11 @@ parse_arguments()
{
[ "$#" -eq 0 ] && usage && return 0
while getopts a:hlo:r:t: opt
while getopts a:dhlo:r:t: opt
do
case $opt in
a) AGENT_VERSION="${OPTARG}" ;;
d) should_delete_unnecessary_files="yes" ;;
h) usage ;;
l) get_distros | sort && exit 0;;
o) OSBUILDER_VERSION="${OPTARG}" ;;