Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ sysroot_flags_to_copy_flags (GLnxFileCopyFlags defaults,
* hardlink if we're on the same partition.
*/
static gboolean
install_into_boot (OstreeRepo *repo,
OstreeSePolicy *sepolicy,
int src_dfd,
const char *src_subpath,
int dest_dfd,
const char *dest_subpath,
GCancellable *cancellable,
GError **error)
install_into_boot_alone (OstreeRepo *repo,
OstreeSePolicy *sepolicy,
int src_dfd,
const char *src_subpath,
int dest_dfd,
const char *dest_subpath,
GCancellable *cancellable,
GError **error)
{
if (linkat (src_dfd, src_subpath, dest_dfd, dest_subpath, 0) == 0)
return TRUE; /* Note early return */
Expand Down Expand Up @@ -175,6 +175,36 @@ install_into_boot (OstreeRepo *repo,
return TRUE;
}

/* As install_into_boot_alone, but also copies a detached signature if any */
static gboolean
install_into_boot (OstreeRepo *repo,
OstreeSePolicy *sepolicy,
int src_dfd,
const char *src_subpath,
int dest_dfd,
const char *dest_subpath,
GCancellable *cancellable,
GError **error)
{
if (!install_into_boot_alone (repo, sepolicy, src_dfd, src_subpath,
dest_dfd, dest_subpath, cancellable, error))
return FALSE;

/* If the source file has a detached signature, install it too */
g_autofree char *src_sig_subpath = g_strdup_printf("%s.sig", src_subpath);
if (!glnx_fstatat_allow_noent (src_dfd, src_sig_subpath, NULL, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
if (errno != ENOENT)
{
g_autofree char *dest_sig_subpath = g_strdup_printf("%s.sig", dest_subpath);
if (!install_into_boot_alone (repo, sepolicy, src_dfd, src_sig_subpath,
dest_dfd, dest_sig_subpath, cancellable, error))
return FALSE;
}

return TRUE;
}

/* Copy ownership, mode, and xattrs from source directory to destination */
static gboolean
dirfd_copy_attributes_and_xattrs (int src_parent_dfd,
Expand Down