postprocess: Init rootfs earlier

There's a lot going on in the final postprocessing; and some
potentially tricky dependencies.  But we can cleanly move up
the "init rootfs" bits, which helps make the rest of the function
closer to the "final postprocessing" we need for
[split compose](https://github.com/projectatomic/rpm-ostree/pull/1039).

Closes: #1044
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-10-06 17:20:45 -04:00 committed by Atomic Bot
parent 236dfd723a
commit d0b225c0ab

View File

@ -869,18 +869,6 @@ create_rootfs_from_pkgroot_content (int target_root_dfd,
error)) error))
return FALSE; return FALSE;
/* Initialize target root */
g_print ("Initializing rootfs\n");
gboolean tmp_is_dir = FALSE;
if (!_rpmostree_jsonutil_object_get_optional_boolean_member (treefile,
"tmp-is-dir",
&tmp_is_dir,
error))
return FALSE;
if (!init_rootfs (target_root_dfd, tmp_is_dir, cancellable, error))
return FALSE;
g_print ("Migrating /etc/passwd to /usr/lib/\n"); g_print ("Migrating /etc/passwd to /usr/lib/\n");
if (!rpmostree_passwd_migrate_except_root (src_rootfs_fd, RPM_OSTREE_PASSWD_MIGRATE_PASSWD, NULL, if (!rpmostree_passwd_migrate_except_root (src_rootfs_fd, RPM_OSTREE_PASSWD_MIGRATE_PASSWD, NULL,
cancellable, error)) cancellable, error))
@ -1637,6 +1625,18 @@ rpmostree_prepare_rootfs_for_commit (int src_rootfs_dfd,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
/* Initialize target root */
g_print ("Initializing rootfs\n");
gboolean tmp_is_dir = FALSE;
if (!_rpmostree_jsonutil_object_get_optional_boolean_member (treefile,
"tmp-is-dir",
&tmp_is_dir,
error))
return FALSE;
if (!init_rootfs (target_rootfs_dfd, tmp_is_dir, cancellable, error))
return FALSE;
/* And call into the bigger postprocessing function */
if (!create_rootfs_from_pkgroot_content (target_rootfs_dfd, src_rootfs_dfd, treefile, if (!create_rootfs_from_pkgroot_content (target_rootfs_dfd, src_rootfs_dfd, treefile,
cancellable, error)) cancellable, error))
return glnx_prefix_error (error, "Finalizing rootfs"); return glnx_prefix_error (error, "Finalizing rootfs");