[ostree] update-kernel: Change dracut to use tmpdir on host, fix deploy path lookup
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] update-kernel: Change dracut to use tmpdir on host, fix deploy path lookup
- Date: Wed, 9 Jan 2013 09:35:09 +0000 (UTC)
commit 50ca6b672b9778482425def123afa0595f1bc05a
Author: Colin Walters <walters verbum org>
Date: Wed Jan 9 04:32:51 2013 -0500
update-kernel: Change dracut to use tmpdir on host, fix deploy path lookup
We had a bit of legacy code that looked for "current" if the deploy
path was unspecified; this needs to be deploy/OSNAME/current.
Secondly, we need to point dracut at a tmpdir outside of the root when
doing FUSE, because directories with mode 0700 and owned by root:root
aren't writable.
Also update libgsystem to the latest.
src/libgsystem | 2 +-
src/ostree/ot-admin-builtin-update-kernel.c | 29 ++++++++++++--------------
2 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/libgsystem b/src/libgsystem
index ba7c19c..6890c19 160000
--- a/src/libgsystem
+++ b/src/libgsystem
@@ -1 +1 @@
-Subproject commit ba7c19cd3b44902ba1dd9bb0fba43293b43abb0b
+Subproject commit 6890c19d51da21de1e45a1ac39020672cf6b2b02
diff --git a/src/ostree/ot-admin-builtin-update-kernel.c b/src/ostree/ot-admin-builtin-update-kernel.c
index 0a46e67..1d94bbc 100644
--- a/src/ostree/ot-admin-builtin-update-kernel.c
+++ b/src/ostree/ot-admin-builtin-update-kernel.c
@@ -32,7 +32,7 @@ typedef struct {
OtAdminBuiltinOpts *admin_opts;
GFile *ostree_dir;
GFile *boot_ostree_dir;
- const char *deploy_path;
+ GFile *deploy_path;
GFile *kernel_path;
char *release;
char *osname;
@@ -87,15 +87,13 @@ setup_kernel (OtAdminUpdateKernel *self,
GError **error)
{
gboolean ret = FALSE;
- ot_lobj GFile *deploy_path = NULL;
ot_lobj GFile *deploy_boot_path = NULL;
ot_lobj GFile *src_kernel_path = NULL;
ot_lfree char *prefix = NULL;
const char *release = NULL;
const char *kernel_name = NULL;
- deploy_path = g_file_new_for_path (self->deploy_path);
- deploy_boot_path = g_file_get_child (deploy_path, "boot");
+ deploy_boot_path = g_file_get_child (self->deploy_path, "boot");
if (!get_kernel_from_boot (deploy_boot_path, &src_kernel_path,
cancellable, error))
@@ -142,7 +140,6 @@ update_initramfs (OtAdminUpdateKernel *self,
GError **error)
{
gboolean ret = FALSE;
- const char *deploy_path = self->deploy_path;
ot_lfree char *initramfs_name = NULL;
ot_lobj GFile *initramfs_file = NULL;
@@ -156,7 +153,6 @@ update_initramfs (OtAdminUpdateKernel *self,
ot_lobj GFile *tmpdir = NULL;
ot_lfree char *initramfs_tmp_path = NULL;
ot_lobj GFile *ostree_vardir = NULL;
- 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;
@@ -190,14 +186,12 @@ update_initramfs (OtAdminUpdateKernel *self,
"--mount-bind", "/dev", "/dev",
"--mount-bind", gs_file_get_path_cached (ostree_vardir), "/var",
"--mount-bind", gs_file_get_path_cached (tmpdir), "/tmp", NULL);
- if (ostree_moduledir)
- ot_ptrarray_add_many (mkinitramfs_args, "--mount-bind", gs_file_get_path_cached (ostree_moduledir), "/lib/modules", NULL);
- ot_ptrarray_add_many (mkinitramfs_args, deploy_path,
- "dracut", "-f", "/tmp/initramfs-ostree.img", self->release,
+ ot_ptrarray_add_many (mkinitramfs_args, gs_file_get_path_cached (self->deploy_path),
+ "dracut", "--tmpdir=/tmp", "-f", "/tmp/initramfs-ostree.img", self->release,
NULL);
g_ptr_array_add (mkinitramfs_args, NULL);
- g_print ("Generating initramfs using %s...\n", deploy_path);
+ g_print ("Generating initramfs using %s...\n", gs_file_get_path_cached (self->deploy_path));
proc = gs_subprocess_new_simple_argv ((gchar**)mkinitramfs_args->pdata,
GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
@@ -243,8 +237,8 @@ update_initramfs (OtAdminUpdateKernel *self,
g_print ("Created: %s\n", gs_file_get_path_cached (initramfs_file));
- (void) gs_file_unlink (initramfs_tmp_file, NULL, NULL);
- (void) rmdir (gs_file_get_path_cached (tmpdir));
+ if (!gs_shutil_rm_rf (tmpdir, cancellable, error))
+ goto out;
}
ret = TRUE;
@@ -352,7 +346,7 @@ ot_admin_builtin_update_kernel (int argc, char **argv, OtAdminBuiltinOpts *admin
self->admin_opts = admin_opts;
- context = g_option_context_new ("OSNAME DEPLOY_PATH - Update kernel and regenerate initial ramfs");
+ context = g_option_context_new ("OSNAME [DEPLOY_PATH] - Update kernel and regenerate initial ramfs");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, error))
@@ -367,9 +361,12 @@ ot_admin_builtin_update_kernel (int argc, char **argv, OtAdminBuiltinOpts *admin
self->osname = g_strdup (argv[1]);
if (argc > 2)
- self->deploy_path = argv[2];
+ self->deploy_path = g_file_new_for_path (argv[2]);
else
- self->deploy_path = "current";
+ {
+ ot_lobj GFile *osdir = ot_gfile_get_child_build_path (admin_opts->ostree_dir, "deploy", self->osname, NULL);
+ self->deploy_path = g_file_get_child (osdir, "current");
+ }
self->ostree_dir = g_object_ref (ostree_dir);
self->boot_ostree_dir = g_file_get_child (admin_opts->boot_dir, "ostree");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]