kernel-install: move staging area to /var/tmp/

The generated files (UKIs...) can potentially be huge, hence create them
in /var/tmp/, rather than /tmp/.
This commit is contained in:
Lennart Poettering
2025-11-03 09:01:44 +01:00
parent 8f62d20b73
commit f8fcf7de7c
2 changed files with 13 additions and 7 deletions
+12 -6
View File
@@ -810,7 +810,6 @@ static int context_ensure_layout(Context *c) {
}
static int context_set_up_staging_area(Context *c) {
static const char *template = "/tmp/kernel-install.staging.XXXXXX";
int r;
assert(c);
@@ -818,12 +817,19 @@ static int context_set_up_staging_area(Context *c) {
if (c->staging_area)
return 0;
if (c->action == ACTION_INSPECT) {
const char *d;
r = var_tmp_dir(&d);
if (r < 0)
return log_error_errno(r, "Failed to determine temporary directory location: %m");
_cleanup_free_ char *template = path_join(d, "kernel-install.staging.XXXXXX");
if (!template)
return log_oom();
if (c->action == ACTION_INSPECT)
/* This is only used for display. The directory will not be created. */
c->staging_area = strdup(template);
if (!c->staging_area)
return log_oom();
} else {
c->staging_area = TAKE_PTR(template);
else {
r = mkdtemp_malloc(template, &c->staging_area);
if (r < 0)
return log_error_errno(r, "Failed to create staging area: %m");
+1 -1
View File
@@ -318,7 +318,7 @@ diff -u <(echo "$output") - >&2 <<EOF
"KERNEL_INSTALL_LAYOUT=other",
"KERNEL_INSTALL_INITRD_GENERATOR=none",
"KERNEL_INSTALL_UKI_GENERATOR=",
"KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.XXXXXX"
"KERNEL_INSTALL_STAGING_AREA=/var/tmp/kernel-install.staging.XXXXXX"
]
}
EOF