summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-checkout.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2017-03-22 11:59:18 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-03-27 13:48:41 +0000
commitbe28c10849607d3dec4ff75553d8467745cc149b (patch)
tree34b955982501ccbd2e1d1fd5403aaee9ea386459 /src/libostree/ostree-repo-checkout.c
parent612150f143e5c8f7b8982273f29e3536d2dde5fd (diff)
downloadostree-be28c10849607d3dec4ff75553d8467745cc149b.tar.gz
Add bare-user-only repo mode
This mode is similar to bare-user, but does not store the permission, ownership (uid/gid) and xattrs in an xattr on the file objects in the repo. Additionally it stores symlinks as symlinks rather than as regular files+xattrs, like the bare mode. The later is needed because we can't store the is-symlink in the xattr. This means that some metadata is lost, such as the uid. When reading a repo like this we always report uid, gid as 0, and no xattrs, so unless this is true in the commit the resulting repository will not fsck correctly. However, it the main usecase of the repository is to check out with --user-mode, then no information is lost, and the repository can work on filesystems without xattrs (such as tmpfs). Closes: #750 Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-repo-checkout.c')
-rw-r--r--src/libostree/ostree-repo-checkout.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index 5611e6e9..09966a94 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -473,7 +473,9 @@ checkout_one_file_at (OstreeRepo *repo,
(current_repo->mode == OSTREE_REPO_MODE_BARE_USER
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER
/* NOTE: bare-user symlinks are not stored as symlinks */
- && !is_symlink));
+ && !is_symlink) ||
+ (current_repo->mode == OSTREE_REPO_MODE_BARE_USER_ONLY
+ && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER));
gboolean current_can_cache = (options->enable_uncompressed_cache
&& current_repo->enable_uncompressed_cache);
gboolean is_archive_z2_with_cache = (current_repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
@@ -862,6 +864,9 @@ ostree_repo_checkout_tree (OstreeRepo *self,
{
OstreeRepoCheckoutAtOptions options = { 0, };
+ if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_BARE_USER_ONLY)
+ mode = OSTREE_REPO_CHECKOUT_MODE_USER;
+
options.mode = mode;
options.overwrite_mode = overwrite_mode;
/* Backwards compatibility */
@@ -948,6 +953,7 @@ ostree_repo_checkout_at (OstreeRepo *self,
GError **error)
{
OstreeRepoCheckoutAtOptions default_options = { 0, };
+ OstreeRepoCheckoutAtOptions real_options;
if (!options)
{
@@ -955,6 +961,13 @@ ostree_repo_checkout_at (OstreeRepo *self,
options = &default_options;
}
+ /* Make a copy so we can modify the options */
+ real_options = *options;
+ options = &real_options;
+
+ if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_BARE_USER_ONLY)
+ options->mode = OSTREE_REPO_CHECKOUT_MODE_USER;
+
g_autoptr(GFile) commit_root = (GFile*) _ostree_repo_file_new_for_commit (self, commit, error);
if (!commit_root)
return FALSE;