admin: Prepare /var/log/dracut.log when creating initramfs

Otherwise dracut complains.
This commit is contained in:
Colin Walters 2012-10-01 10:25:36 -04:00
parent 758d6132e3
commit 8153799121
1 changed files with 11 additions and 0 deletions

View File

@ -88,6 +88,8 @@ update_initramfs (OtAdminUpdateKernel *self,
ot_lobj GFile *ostree_moduledir = NULL;
ot_lobj GFile *initramfs_tmp_file = NULL;
ot_lobj GFileInfo *initramfs_tmp_info = NULL;
ot_lobj GFile *dracut_log_path = NULL;
ot_lobj GOutputStream *tmp_log_out = NULL;
if (!ostree_create_temp_dir (NULL, "ostree-initramfs", NULL, &tmpdir,
cancellable, error))
@ -96,6 +98,15 @@ update_initramfs (OtAdminUpdateKernel *self,
ostree_vardir = g_file_get_child (self->ostree_dir, "var");
ostree_moduledir = g_file_get_child (self->ostree_dir, "modules");
dracut_log_path = ot_gfile_get_child_build_path (ostree_vardir, "log", "dracut.log", NULL);
tmp_log_out = (GOutputStream*)g_file_replace (dracut_log_path, NULL, FALSE,
G_FILE_CREATE_REPLACE_DESTINATION,
cancellable, error);
if (!tmp_log_out)
goto out;
if (!g_output_stream_close (tmp_log_out, cancellable, error))
goto out;
mkinitramfs_args = g_ptr_array_new ();
/* Note: the hardcoded /tmp path below is not actually a
* security flaw, because we've bind-mounted dracut's view