ostreedev / ostree-rs-ext

Rust library with higher level APIs on top of the core ostree API
Apache License 2.0
74 stars 24 forks source link

Move /var content to /usr/share/factory/var #569

Closed cgwalters closed 9 months ago

cgwalters commented 9 months ago

Instead of dropping /var content on the floor, move it into /usr/share/factory/var.

With this change, a systemd-tmpfiles fragment like this: C+ /var - - - - - is sufficient to get "populate /var" automatically on initial installation and across upgrades.

cgwalters commented 9 months ago

Pairs with https://github.com/ostreedev/ostree/pull/3103

rhatdan commented 9 months ago

LGTM @vrothberg PTAL

mrguitar commented 9 months ago

Will this also solve the problem of rpms installing under /opt? ...he asked while making doe eyes at @cgwalters
On the surface it seems like it would.

cgwalters commented 9 months ago

Will this also solve the problem of rpms installing under /opt?

The core issue remains that:

But yes, some will probably start working modulo those caveats.

vrothberg commented 9 months ago

@cgwalters are the caveats recorded/documented somewhere?

travier commented 8 months ago

From https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html (see https://github.com/ostreedev/ostree/pull/3103):

C, C+
           Recursively copy a file or directory, if the destination files or directories do not exist yet
           or the destination directory is empty. Note that this command will not descend into
           subdirectories if the destination directory already exists and is not empty, unless the action
           is suffixed with +. Instead, the entire copy operation is skipped. If the argument is omitted,
           files from the source directory /usr/share/factory/ with the same name are copied. Does not
           follow symlinks. Contents of the directories are subject to time-based cleanup if the age
           argument is specified.

If I understand correctly, I've found the following caveats to document:

On updates (N -> N+1), the following will happen:

On rollbacks (N+1 -> N):

In general, I think we should recommend users include another unit that calls to rsync (for example) with a list of files to update in sync between updates on boot. If they want files to be removed, they will have to make another unit.

I still need to verify that C+ does not overwrite existing files on update. This is unclear from the man page.