diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-10-17 04:10:16 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-10-17 04:10:16 +0000 |
| commit | 6ada80ed7e45ed630e4d9877a9b11e2dfddb4758 (patch) | |
| tree | 61d28af958e9922d1a2380b42b8137a0ac64be51 /src/repo/s6-rc-set-commit.c | |
| parent | db3fb428599c9c8fe105dcf4ba8d1c914c54cc26 (diff) | |
| download | s6-rc-6ada80ed7e45ed630e4d9877a9b11e2dfddb4758.tar.gz | |
Third part of the format-upgrade inclusion: add support in s6-rc-set-install
Now that everything is in place, we go for the main thing: add
snapshot support to s6-rc-set install. The workflow is:
- check the major version of the old db against the current s6-rc
- if the old db is up to date, nothing changes
- otherwise:
+ find the snapshot corresponding to the old db
+ compile it
+ copy the snapshot db to the bootdir
+ call s6-rc-format-upgrade on it
+ atomically switch the bootdb to it. At this point the snapshot
is the new bootdb: same as the old db, but with the correct major version.
+ unconditionally remove the old db
+ and now we can perform the regular s6-rc-update with the
wanted set, since they have the same major.
We also add --no-snapshot options to s6-rc-set-commit and
s6-rc-set-install, and propagate them in the supporting functions,
so users can manually skip all this bloat (and this is important
for the initial install).
All that remains is cleaning up obsolete snapshots. This will
probably go at the end of s6-rc-set-install as well.
Diffstat (limited to 'src/repo/s6-rc-set-commit.c')
| -rw-r--r-- | src/repo/s6-rc-set-commit.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/repo/s6-rc-set-commit.c b/src/repo/s6-rc-set-commit.c index 6bfe03d..3bc0f4a 100644 --- a/src/repo/s6-rc-set-commit.c +++ b/src/repo/s6-rc-set-commit.c @@ -26,7 +26,8 @@ enum golb_e { GOLB_KEEPOLD = 0x01, - GOLB_FORCE = 0x02 + GOLB_FORCE = 0x02, + GOLB_NOSNAP = 0x04, } ; enum gola_e @@ -42,7 +43,9 @@ enum gola_e static gol_bool const rgolb[] = { { .so = 'K', .lo = "keep-old", .clear = 0, .set = GOLB_KEEPOLD }, - { .so = 'f', .lo = "force", .clear = 0, .set = GOLB_FORCE } + { .so = 'f', .lo = "force", .clear = 0, .set = GOLB_FORCE }, + { .so = 0, .lo = "snapshot", .clear = GOLB_NOSNAP, .set = 0 }, + { .so = 0, .lo = "no-snapshot", .clear = 0, .set = GOLB_NOSNAP }, } ; static gol_arg const rgola[] = @@ -86,7 +89,7 @@ int main (int argc, char const *const *argv) if (r) _exit(r) ; if (!(wgolb & GOLB_FORCE)) { - r = s6rc_repo_setuptodate(wgola[GOLA_REPODIR], argv[0]) ; + r = s6rc_repo_setuptodate(wgola[GOLA_REPODIR], argv[0], !!(wgolb & GOLB_NOSNAP)) ; if (r == -1) _exit(111) ; if (r) { @@ -112,7 +115,7 @@ int main (int argc, char const *const *argv) size_t oldclen = S6RC_REPO_COMPILE_BUFLEN(strlen(wgola[GOLA_REPODIR]), strlen(argv[0])) ; char oldc[oldclen] ; - r = s6rc_repo_setcompile(wgola[GOLA_REPODIR], argv[0], wgola[GOLA_DEFBUNDLE], oldc, verbosity, wgola[GOLA_FDHUSER], wgola[GOLA_CATCHALL]) ; + r = s6rc_repo_setcompile(wgola[GOLA_REPODIR], argv[0], wgola[GOLA_DEFBUNDLE], oldc, verbosity, wgola[GOLA_FDHUSER], wgola[GOLA_CATCHALL], !!(wgolb & GOLB_NOSNAP)) ; if (r == -1) _exit(111) ; if (!r) _exit(1) ; if (r == 2) |
