swupd-client icon indicating copy to clipboard operation
swupd-client copied to clipboard

explicitly specify stagedir

Open pohly opened this issue 7 years ago • 7 comments

By default, swupd stages content under the statedir, which is not useful for a statedir that is not on the same partition as the target path, because then staged files need to be copied once more. See https://github.com/clearlinux/swupd-client/issues/249#issuecomment-329431119

Please add an explicit --stagedir which overrides the default.

pohly avatar Sep 26 '17 14:09 pohly

@pohly Since swupd currently has two staging phases, can you clarify what --stagedir should refer to? The phases are (a) extracting fullfiles and applying deltas to populate the content of STATEDIR/staged, and (b) hardlinking (or copying) the appropriate STATEDIR/staged files to hidden files at the destination path under PATHPREFIX/.

Step (b) occurs in the do_staging() function, and step (a) manipulates the STATEDIR/staged directory, so the terminology is a bit confusing at the moment.

phmccarty avatar Sep 26 '17 16:09 phmccarty

On second thought, I'm guessing you mean step (a) as I describe above, because there are usually multiple directories involved in step (b).

phmccarty avatar Sep 26 '17 16:09 phmccarty

The goal is to implement step (b) using hardlinking instead of having to copy.

My understanding is that letting --stagedir override the STATEDIR/staged default will achive that if a directory is chosen on the target partition.

pohly avatar Sep 26 '17 16:09 pohly

With lots of assumptions, like there is only one target partition.

This assumption is invalid in one of the things I am looking at, so it has to have a fallback to allow copying. Would not manually creating a symlink for STATEDIR/staged to /mount/your/desired/partition/staged achieve what you want?

From: Patrick Ohly [mailto:[email protected]] Sent: Tuesday, September 26, 2017 9:50 AM To: clearlinux/swupd-client [email protected] Cc: Subscribed [email protected] Subject: Re: [clearlinux/swupd-client] explicitly specify stagedir (#273)

The goal is to implement step (b) using hardlinking instead of having to copy.

My understanding is that letting --stagedir override the STATEDIR/staged default will achive that if a directory is chosen on the target partition.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/clearlinux/swupd-client/issues/273#issuecomment-332262845, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AUTyz0Gpqu2pGXCyuh58H-fMFg0-1QI-ks5smSsvgaJpZM4PkTnI.

icarus-sparry avatar Sep 26 '17 16:09 icarus-sparry

@icarus-sparry yes, I can mess around with the statedir and create a symlink like you said. I think an explicit command line option would be clear and avoid embedding such knowledge about swupd internals in the script calling swupd.

pohly avatar Sep 26 '17 16:09 pohly

Can you explain why you can't just specify --statedir instead of a separate --stagedir? As far as content size goes, most of it is put in staged/ anyways, so having the entire statedir on the other partition doesn't seem like a big hit to me.

matthewrsj avatar Nov 01 '17 17:11 matthewrsj

The intended partitioning is "two small system partitions (active and inactive), large data partition". --statedir is also used for downloaded tar archives and manifest files. Putting those onto the target partition increases the space overhead that is needed for swupd on the target partition. Less overhead is better. So while it is technically feasible, it's not as good as it good be.

A better solution would use the data partition for all files which do not have to be on the system partition. The staging directory needs to be on the system partition, to ensure that directory rewriting remains efficient (no need to write files, just delete + rename).

pohly avatar Nov 01 '17 18:11 pohly