diff options
| -rw-r--r-- | NEWS | 2 | ||||
| -rwxr-xr-x | configure | 8 | ||||
| -rw-r--r-- | doc/s6-rc-init.html | 30 | ||||
| -rw-r--r-- | doc/s6-rc-set-install.html | 15 | ||||
| -rw-r--r-- | doc/upgrade.html | 3 | ||||
| -rw-r--r-- | package/configure-snippets/configure_case_lines | 1 | ||||
| -rw-r--r-- | package/configure-snippets/configure_generate_configh | 5 | ||||
| -rw-r--r-- | package/configure-snippets/configure_help_install | 1 | ||||
| -rw-r--r-- | package/configure-snippets/configure_init_vars | 1 | ||||
| -rw-r--r-- | src/include/s6-rc/s6rc-constants.h | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-repo-init.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-repo-sync.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-change.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-commit.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-copy.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-delete.c | 2 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-install.c | 42 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-new.c | 2 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-bundle.c | 2 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-db.c | 2 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-format-upgrade.c | 2 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-init.c | 4 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-oneshot-run.c | 2 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc-update.c | 4 | ||||
| -rw-r--r-- | src/s6-rc/s6-rc.c | 2 |
25 files changed, 86 insertions, 56 deletions
@@ -8,6 +8,8 @@ In 0.6.0.0 - New: s6-rc-repo-* and s6-rc-set-* binaries, the "repo" collection of tools to help with management of source definition directories. + - The boot database is now configurable at build time (--bootdb) +and the default is now /etc/s6-rc/compiled/current. In 0.5.6.0 @@ -25,6 +25,7 @@ Fine tuning of the installation directories: --includedir=DIR C header files [PREFIX/include] --sysconfdir=DIR global configuration files [PREFIX/etc] --pkgconfdir=DIR pkg-config .pc files [PREFIX/lib/pkgconfig] + --bootdb=PATH default path for the boot database [/etc/s6-rc/compiled/current] --livedir=DIR default live directory [/run/s6-rc] --repodir=DIR default repo directory [/var/lib/s6-rc/repository] @@ -170,6 +171,7 @@ deplibpath='' vpaths='' vpathd='' build= +bootdb=/etc/s6-rc/compiled/current livedir=/run/s6-rc repodir=/var/lib/s6-rc/repository @@ -209,6 +211,7 @@ for arg ; do --disable-slashpackage) sproot= ; slashpackage=false ;; --enable-absolute-paths|--enable-absolute-paths=yes) abspath=true ;; --disable-absolute-paths|--enable-absolute-paths=no) abspath=false ;; + --bootdb=*) bootdb=${arg#*=} ;; --livedir=*) livedir=${arg#*=} ;; --repodir=*) repodir=${arg#*=} ;; @@ -549,8 +552,9 @@ else fi echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\"" echo "#define ${package_macro_name}_SYSCONFPREFIX \"$sysconfdir/\"" -echo "#define ${package_macro_name}_LIVE_BASE \"$livedir\"" -echo "#define ${package_macro_name}_REPO_BASE \"$repodir\"" +echo "#define ${package_macro_name}_BOOTDB \"$bootdb\"" +echo "#define ${package_macro_name}_LIVEDIR \"$livedir\"" +echo "#define ${package_macro_name}_REPODIR \"$repodir\"" echo echo "#endif" diff --git a/doc/s6-rc-init.html b/doc/s6-rc-init.html index afe10cd..3f181a8 100644 --- a/doc/s6-rc-init.html +++ b/doc/s6-rc-init.html @@ -28,22 +28,22 @@ invocation of the <h2> Interface </h2> <pre> - s6-rc-init [ -c <em>compiled</em> ] [ -l <em>live</em> ] [ -p <em>prefix</em> ] [ -t <em>timeout</em> ] [ -b ] [ -d ] <em>scandir</em> + s6-rc-init [ -c <em>bootdb</em> ] [ -l <em>live</em> ] [ -p <em>prefix</em> ] [ -t <em>timeout</em> ] [ -b ] [ -d ] <em>scandir</em> </pre> <ul> - <li> <em>compiled</em> (if the <tt>-d</tt> option hasn't been given), + <li> <em>bootdb</em> (if the <tt>-d</tt> option hasn't been given), <em>live</em> and <em>scandir</em> must be absolute paths. </li> <li> s6-rc-init expects to find a <em>compiled service database</em> -in <em>compiled</em>. It expects to be able to create a directory +in <em>bootdb</em>. It expects to be able to create a directory named <em>live</em>. It also expects that an instance of <a href="//skarnet.org/software/s6/s6-svscan.html">s6-svscan</a> is running on <em>scandir</em>. </li> <li> s6-rc-init initializes the live state in <em>live</em>. It -declares <em>compiled</em> as the current service database and +declares <em>bootdb</em> as the current service database and sets the state as "all services down". </li> <li> It then copies verbatim all -the service directories declared by <em>compiled</em> into a +the service directories declared by <em>bootdb</em> into a subdirectory of <em>live</em>, adds <tt>./down</tt> files to the live copies and links those live copies into <em>scandir</em>. It then triggers <a href="//skarnet.org/software/s6/s6-svscan.html">s6-svscan</a>, @@ -64,9 +64,12 @@ milliseconds, s6-rc-init will complain and exit 111. This is a safety feature so s6-rc-init doesn't hang indefinitely on a nonworking installation; normally this initialization should not take more than a few milliseconds. </li> - <li> <tt>-c <em>compiled</em></tt> : declare <em>compiled</em> + <li> <tt>-c <em>bootdb</em></tt> : declare <em>bootdb</em> as the current compiled service database for the upcoming live state. -Default is <tt>/etc/s6-rc/compiled</tt>. </li> +Default is <tt>/etc/s6-rc/compiled/current</tt>. Note that <em>bootdb</em> +should always be a symlink pointing to the real compiled database: that +is how databases can be live switched without modifying the boot +process that invokes s6-rc-init. </li> <li> <tt>-l <em>live</em></tt> : Store the live state into the <em>live</em> directory, which should not exist prior to running s6-rc-init, but should be under a writable filesystem - likely a RAM @@ -91,11 +94,10 @@ being used by another program, s6-rc-init will wait until that other program has released its lock on the database, then proceed. By default, s6-rc-init fails with an error message if the database is currently in use. </li> - <li><tt>-d</tt> : dereference <em>compiled</em>. Fully resolve -the <em>compiled</em> path before declaring it as the current -compiled service database for the upcoming live state. This allows -<em>compiled</em> to be a symlink that can be updated later without -impacting the current live state. Using this flag in your init scripts' + <li><tt>-d</tt> : dereference <em>bootdb</em>. Fully resolve +the <em>bootdb</em> path before declaring it as the current +compiled service database for the upcoming live state. +Using this flag in your init scripts' <tt>s6-rc-init</tt> invocation means that it's possible to boot on a compiled service database whose validity has not previously been guaranteed by a successful <a href="s6-rc-update.html">s6-rc-update</a> @@ -137,11 +139,11 @@ and updates the live state by atomically changing the target of the the real directory may. </li> <li> Similarly, it is recommended that administrators store their compiled service databases into some versioned directory, and that -<em>compiled</em> be a symbolic link to the database currently in +<em>bootdb</em> be a symbolic link to the database currently in use. This will make it easier to create new compiled databases and switch them with <a href="s6-rc-update.html">s6-rc-update</a> without having to change the s6-rc-init invocation in boot scripts. </li> - <li> After s6-rc-init runs, <em>compiled</em> has become the + <li> After s6-rc-init runs, <em>bootdb</em> has become the "live compiled database", and must not be tampered with or deleted. The only way to free it for deletion is to replace it with another database, via a call to <a href="s6-rc-update.html">s6-rc-update</a>. </li> diff --git a/doc/s6-rc-set-install.html b/doc/s6-rc-set-install.html index 02b01f8..c3051f4 100644 --- a/doc/s6-rc-set-install.html +++ b/doc/s6-rc-set-install.html @@ -5,7 +5,7 @@ <meta http-equiv="Content-Language" content="en" /> <title>s6-rc: the s6-rc-set-install program</title> <meta name="Description" content="s6-rc: the s6-rc-set-install program" /> - <meta name="Keywords" content="s6-rc s6-rc-set-install repo set installation update s6-rc-update boot" /> + <meta name="Keywords" content="s6-rc s6-rc-set-install repo set installation update s6-rc-update boot bootdb" /> <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> </head> <body> @@ -31,16 +31,18 @@ the <em>live database</em> of the currently running system. <h2> Interface </h2> <pre> - s6-rc-set-install [ -v <em>verbosity</em> ] [ -r <em>repo</em> ] [ -l <em>livedir</em> ] [ -f <em>convfile</em> ] [ -b ] [ -K ] <em>set</em> <em>bootdbdir</em> + s6-rc-set-install [ -v <em>verbosity</em> ] [ -r <em>repo</em> ] [ -c <em>bootdb</em> ] [ -l <em>livedir</em> ] [ -f <em>convfile</em> ] [ -b ] [ -K ] <em>set</em> </pre> <ul> <li> s6-rc-set-install checks that the <a href="repodefs.html#set">set</a> of services <em>set</em> has been <a href="repodefs.html#commit">committed</a> and that no changes have occurred since. </li> - <li> It takes the corresponding service database and copies it to <em>bootdbdir</em>. </li> + <li> It takes the corresponding service database and copies it to the same directory as <em>bootdb</em>. </li> <li> It calls <a href="s6-rc-update.html">s6-rc-update</a> on that copy of the compiled service database, which makes it the new <em>live</em> database. Some services may be stopped, and other started, in the process. </li> + <li> It updates the <em>bootdb</em> link to point to the new database, so that +next boot uses it. </li> </ul> <h2> Options </h2> @@ -55,6 +57,13 @@ error messages will be written, and 2 or more adds informational messages. </dd> <dd> Use the repository in <em>repo</em>, which must exist. Default is <strong>/var/lib/s6-rc/repository</strong>. </dd> + <dt> -c <em>bootdb</em>, --bootdb=<em>bootdb</em> </dt> + <dd> Use <em>bootdb</em> as the path to the boot-time database. This must be +the same path that is given to the <tt>-c</tt> option of +<a href="s6-rc-init.html">s6-rc-init</a> at boot time. The default is +<strong><tt>/etc/s6-rc/compiled/current</tt></strong>. Note that <em>bootdb</em> +must always be a symlink, pointing to the real compiled database at any time. </dd> + <dt> -l <em>livedir</em>, --livedir=<em>livedir</em> </dt> <dd> Assume the <em>live directory</em> of the machine, as created by <a href="s6-rc-init.html">s6-rc-init</a>, is <em>livedir</em>. The default diff --git a/doc/upgrade.html b/doc/upgrade.html index dba10f9..ddc5e3b 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -39,6 +39,9 @@ dependency bumped to 2.14.5.0. </li> dependency bumped to 2.9.8.0. </li> <li> <a href="//skarnet.org/software/s6/">s6</a> dependency bumped to 2.13.3.0. </li> + <li> The macros in <tt>s6-rc/config.h</tt> have changed. +<tt>S6RC_LIVE_BASE</tt> is now named <tt>S6RC_LIVEDIR</tt>, in +addition to the new <tt>S6RC_REPODIR</tt> and <tt>S6RC_BOOTDB</tt>. </li> </ul> <h2> in 0.5.6.0 </h2> diff --git a/package/configure-snippets/configure_case_lines b/package/configure-snippets/configure_case_lines index 1659cc4..1dcbf11 100644 --- a/package/configure-snippets/configure_case_lines +++ b/package/configure-snippets/configure_case_lines @@ -1,3 +1,4 @@ + --bootdb=*) bootdb=${arg#*=} ;; --livedir=*) livedir=${arg#*=} ;; --repodir=*) repodir=${arg#*=} ;; diff --git a/package/configure-snippets/configure_generate_configh b/package/configure-snippets/configure_generate_configh index 679b6f8..ba49153 100644 --- a/package/configure-snippets/configure_generate_configh +++ b/package/configure-snippets/configure_generate_configh @@ -1,3 +1,4 @@ -echo "#define ${package_macro_name}_LIVE_BASE \"$livedir\"" -echo "#define ${package_macro_name}_REPO_BASE \"$repodir\"" +echo "#define ${package_macro_name}_BOOTDB \"$bootdb\"" +echo "#define ${package_macro_name}_LIVEDIR \"$livedir\"" +echo "#define ${package_macro_name}_REPODIR \"$repodir\"" diff --git a/package/configure-snippets/configure_help_install b/package/configure-snippets/configure_help_install index cb03148..6f256b0 100644 --- a/package/configure-snippets/configure_help_install +++ b/package/configure-snippets/configure_help_install @@ -1,3 +1,4 @@ + --bootdb=PATH default path for the boot database [/etc/s6-rc/compiled/current] --livedir=DIR default live directory [/run/s6-rc] --repodir=DIR default repo directory [/var/lib/s6-rc/repository] diff --git a/package/configure-snippets/configure_init_vars b/package/configure-snippets/configure_init_vars index e3d8701..04e5418 100644 --- a/package/configure-snippets/configure_init_vars +++ b/package/configure-snippets/configure_init_vars @@ -1,2 +1,3 @@ +bootdb=/etc/s6-rc/compiled/current livedir=/run/s6-rc repodir=/var/lib/s6-rc/repository diff --git a/src/include/s6-rc/s6rc-constants.h b/src/include/s6-rc/s6rc-constants.h index 168dac8..833e0a7 100644 --- a/src/include/s6-rc/s6rc-constants.h +++ b/src/include/s6-rc/s6rc-constants.h @@ -3,8 +3,6 @@ #ifndef S6RC_CONSTANTS_H #define S6RC_CONSTANTS_H -#define S6RC_COMPILED_BASE "/etc/s6-rc/compiled" - #define S6RC_ONESHOT_RUNNER "s6rc-oneshot-runner" #define S6RC_ONESHOT_RUNNER_LEN (sizeof S6RC_ONESHOT_RUNNER - 1) diff --git a/src/repo/s6-rc-repo-init.c b/src/repo/s6-rc-repo-init.c index 3c353fe..c18b7a3 100644 --- a/src/repo/s6-rc-repo-init.c +++ b/src/repo/s6-rc-repo-init.c @@ -72,7 +72,7 @@ int main (int argc, char const *const *argv) int lockfd ; PROG = "s6-rc-repo-init" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/repo/s6-rc-repo-sync.c b/src/repo/s6-rc-repo-sync.c index ce04d7b..282f181 100644 --- a/src/repo/s6-rc-repo-sync.c +++ b/src/repo/s6-rc-repo-sync.c @@ -35,7 +35,7 @@ int main (int argc, char const *const *argv) int fdlock, r ; PROG = "s6-rc-repo-sync" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = gol_main(argc, argv, 0, 0, rgola, 3, 0, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/repo/s6-rc-set-change.c b/src/repo/s6-rc-set-change.c index d5ca4ed..1ab92f6 100644 --- a/src/repo/s6-rc-set-change.c +++ b/src/repo/s6-rc-set-change.c @@ -108,7 +108,7 @@ int main (int argc, char const *const *argv) uint32_t listn, n ; PROG = "s6-rc-set-change" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/repo/s6-rc-set-commit.c b/src/repo/s6-rc-set-commit.c index efdb2a9..45d5708 100644 --- a/src/repo/s6-rc-set-commit.c +++ b/src/repo/s6-rc-set-commit.c @@ -61,7 +61,7 @@ int main (int argc, char const *const *argv) int r ; PROG = "s6-rc-set-commit" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; wgola[GOLA_DEFBUNDLE] = "default" ; golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ; diff --git a/src/repo/s6-rc-set-copy.c b/src/repo/s6-rc-set-copy.c index 3093aaf..21b9cda 100644 --- a/src/repo/s6-rc-set-copy.c +++ b/src/repo/s6-rc-set-copy.c @@ -111,7 +111,7 @@ int main (int argc, char const *const *argv) unsigned int golc ; PROG = "s6-rc-set-copy" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/repo/s6-rc-set-delete.c b/src/repo/s6-rc-set-delete.c index d0d0f96..24459f5 100644 --- a/src/repo/s6-rc-set-delete.c +++ b/src/repo/s6-rc-set-delete.c @@ -90,7 +90,7 @@ int main (int argc, char const *const *argv) unsigned int golc ; PROG = "s6-rc-set-delete" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = gol_main(argc, argv, 0, 0, rgola, 2, 0, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/repo/s6-rc-set-install.c b/src/repo/s6-rc-set-install.c index e8893b2..22f46b4 100644 --- a/src/repo/s6-rc-set-install.c +++ b/src/repo/s6-rc-set-install.c @@ -16,13 +16,15 @@ #include <skalibs/buffer.h> #include <skalibs/strerr.h> #include <skalibs/gol.h> +#include <skalibs/stralloc.h> #include <skalibs/djbunix.h> #include <skalibs/cspawn.h> +#include <skalibs/unix-transactional.h> #include <s6-rc/config.h> #include <s6-rc/s6rc.h> -#define USAGE "s6-rc-set-install [ -v verbosity ] [ -l livedir ] [ -r repo ] [ -f convfile ] [ -b ] [ -K ] set bootdbdir" +#define USAGE "s6-rc-set-install [ -v verbosity ] [ -c bootdb ] [ -l livedir ] [ -r repo ] [ -f convfile ] [ -b ] [ -K ] set" #define dieusage() strerr_dieusage(100, USAGE) enum golb_e @@ -34,6 +36,7 @@ enum golb_e enum gola_e { GOLA_VERBOSITY, + GOLA_BOOTDB, GOLA_LIVEDIR, GOLA_REPODIR, GOLA_CONVFILE, @@ -49,6 +52,7 @@ static gol_bool const rgolb[] = static gol_arg const rgola[] = { { .so = 'v', .lo = "verbosity", .i = GOLA_VERBOSITY }, + { .so = 'c', .lo = "bootdb", .i = GOLA_BOOTDB }, { .so = 'l', .lo = "livedir", .i = GOLA_LIVEDIR }, { .so = 'r', .lo = "repodir", .i = GOLA_REPODIR }, { .so = 'f', .lo = "conversion-file", .i = GOLA_CONVFILE } @@ -62,16 +66,18 @@ int main (int argc, char const *const *argv) uint64_t wgolb = 0 ; unsigned int golc ; int r ; + stralloc sa = STRALLOC_ZERO ; PROG = "s6-rc-set-install" ; - wgola[GOLA_LIVEDIR] = S6RC_LIVE_BASE ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_BOOTDB] = S6RC_BOOTDB ; + wgola[GOLA_LIVEDIR] = S6RC_LIVEDIR ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = GOL_main(argc, argv, rgolb, rgola, &wgolb, wgola) ; argc -= golc ; argv += golc ; if (wgola[GOLA_VERBOSITY] && !uint0_scan(wgola[GOLA_VERBOSITY], &verbosity)) strerr_dief1x(100, "verbosity needs to be an unsigned integer") ; - if (argc < 2) dieusage() ; + if (!argc) dieusage() ; if (strchr(argv[0], '/') || strchr(argv[0], '\n')) strerr_dief1x(100, "set names cannot contain / or newlines") ; @@ -84,11 +90,14 @@ int main (int argc, char const *const *argv) if (r == -1) _exit(111) ; if (!r) strerr_dief3x(7, "set ", argv[0], " is not up-to-date; commit it first") ; + if (!sadirname(&sa, wgola[GOLA_BOOTDB], strlen(wgola[GOLA_BOOTDB])) + || !stralloc_0(&sa)) strerr_diefu1sys(111, "sadirname") ; + sa.len-- ; + { size_t repolen = strlen(wgola[GOLA_REPODIR]) ; size_t setlen = strlen(argv[0]) ; size_t clen = S6RC_REPO_COMPILE_BUFLEN(repolen, setlen) ; - size_t dstlen = strlen(argv[1]) ; ssize_t l ; pid_t pid ; int wstat ; @@ -97,32 +106,28 @@ int main (int argc, char const *const *argv) char fmtv[UINT_FMT] ; char clink[repolen + setlen + 11] ; char cfull[clen] ; - char dstfn[dstlen + setlen + 36] ; + char dstfn[sa.len + setlen + 36] ; fmtv[uint_fmt(fmtv, verbosity)] = 0 ; memcpy(clink, wgola[GOLA_REPODIR], repolen) ; memcpy(clink + repolen, "/compiled/", 10) ; memcpy(clink + repolen + 10, argv[0], setlen + 1) ; memcpy(cfull, clink, repolen + 10) ; - memcpy(dstfn, argv[1], dstlen) ; - dstfn[dstlen] = '/' ; + memcpy(dstfn, sa.s, sa.len) ; + dstfn[sa.len] = '/' ; l = readlink(clink, cfull + repolen + 10, setlen + 35) ; if (l == -1) strerr_diefu2sys(111, "readlink ", clink) ; if (l >= setlen + 35) strerr_diefu2x(102, "incorrect/unexpected link contents for ", clink) ; cfull[repolen + 10 + l] = 0 ; - memcpy(dstfn + dstlen + 1, cfull + repolen + 10, l+1) ; + memcpy(dstfn + sa.len + 1, cfull + repolen + 10, l+1) ; l = 0 ; { struct stat st ; - if (stat(argv[1], &st) == -1) - strerr_diefu2sys(111, "stat ", argv[1]) ; - if (!S_ISDIR(st.st_mode)) - strerr_dief2x(100, argv[1], " is not a directory") ; if (stat(dstfn, &st) == -1) { if (errno != ENOENT) strerr_diefu2sys(111, "stat ", dstfn) ; } - else strerr_dief2x(102, dstfn, " already exists!?") ; + else strerr_dief2x(102, dstfn, " already exists") ; } { size_t llen = strlen(wgola[GOLA_LIVEDIR]) ; @@ -182,7 +187,7 @@ int main (int argc, char const *const *argv) fmt[int_fmt(fmt, r)] = 0 ; rm_rf(dstfn) ; errno = e ; - strerr_dief4x(r, uargv[0], " exited with code ", fmt, ": live database switch NOT performed") ; + strerr_dief4x(r, uargv[0], " exited with code ", fmt, " (live database switch was NOT performed)") ; } if (olddb) { @@ -190,7 +195,7 @@ int main (int argc, char const *const *argv) { if (buffer_puts(buffer_1small, olddb) == -1 || !buffer_putflush(buffer_1small, "\n", 1)) - strerr_diefu1sys(111, "write to stdout (live database switch performed)") ; + strerr_diefu2sys(111, "write to stdout", " (live database switch was performed)") ; } else rm_rf(olddb) ; } @@ -198,8 +203,11 @@ int main (int argc, char const *const *argv) { char fmt[INT_FMT] ; fmt[int_fmt(fmt, r)] = 0 ; - strerr_dief4x(r, uargv[0], " exited with code ", fmt, ", but the live database switch was performed") ; + strerr_dief4x(r, uargv[0], " exited with code ", fmt, " (live database switch was performed") ; } + if (!atomic_symlink4(dstfn + sa.len + 1, argv[1], 0, 0)) + strerr_diefu6sys(111, "symlink ", dstfn + sa.len + 1, " to ", argv[1], " (live database switch was performed)", " (update that link manually or next boot might fail)") ; } + // stralloc_free(&sa) ; _exit(0) ; } diff --git a/src/repo/s6-rc-set-new.c b/src/repo/s6-rc-set-new.c index 010c2b1..e81bee3 100644 --- a/src/repo/s6-rc-set-new.c +++ b/src/repo/s6-rc-set-new.c @@ -106,7 +106,7 @@ int main (int argc, char const *const *argv) unsigned int golc ; PROG = "s6-rc-set-new" ; - wgola[GOLA_REPODIR] = S6RC_REPO_BASE ; + wgola[GOLA_REPODIR] = S6RC_REPODIR ; golc = gol_main(argc, argv, 0, 0, rgola, 2, 0, wgola) ; argc -= golc ; argv += golc ; diff --git a/src/s6-rc/s6-rc-bundle.c b/src/s6-rc/s6-rc-bundle.c index 5c486d5..d2b447a 100644 --- a/src/s6-rc/s6-rc-bundle.c +++ b/src/s6-rc/s6-rc-bundle.c @@ -225,7 +225,7 @@ static inline unsigned int parse_command (char const *command) int main (int argc, char const **argv) { - char const *live = S6RC_LIVE_BASE ; + char const *live = S6RC_LIVEDIR ; char const *compiled = 0 ; unsigned int what ; int force = 0 ; diff --git a/src/s6-rc/s6-rc-db.c b/src/s6-rc/s6-rc-db.c index 56ee3d7..4b4c081 100644 --- a/src/s6-rc/s6-rc-db.c +++ b/src/s6-rc/s6-rc-db.c @@ -320,7 +320,7 @@ static inline unsigned int parse_list (char const *command) int main (int argc, char const *const *argv) { - char const *live = S6RC_LIVE_BASE ; + char const *live = S6RC_LIVEDIR ; unsigned int what, subwhat = 0 ; int up = 1 ; int blocking = 0 ; diff --git a/src/s6-rc/s6-rc-format-upgrade.c b/src/s6-rc/s6-rc-format-upgrade.c index e2db73f..e7e29b5 100644 --- a/src/s6-rc/s6-rc-format-upgrade.c +++ b/src/s6-rc/s6-rc-format-upgrade.c @@ -33,7 +33,7 @@ static inline void update_livedir (char const *live, char const *newcompiled, ta int main (int argc, char const *const *argv, char const *const *envp) { tain deadline ; - char const *live = S6RC_LIVE_BASE ; + char const *live = S6RC_LIVEDIR ; int blocking = 0 ; int livelock ; PROG = "s6-rc-format-upgrade" ; diff --git a/src/s6-rc/s6-rc-init.c b/src/s6-rc/s6-rc-init.c index 19b4770..05c5b37 100644 --- a/src/s6-rc/s6-rc-init.c +++ b/src/s6-rc/s6-rc-init.c @@ -32,8 +32,8 @@ int main (int argc, char const *const *argv) tain deadline ; stralloc sa = STRALLOC_ZERO ; size_t dirlen ; - char const *live = S6RC_LIVE_BASE ; - char const *compiled = S6RC_COMPILED_BASE ; + char const *live = S6RC_LIVEDIR ; + char const *compiled = S6RC_BOOTDB ; char const *prefix = "" ; int deref = 0 ; PROG = "s6-rc-init" ; diff --git a/src/s6-rc/s6-rc-oneshot-run.c b/src/s6-rc/s6-rc-oneshot-run.c index 136a318..87a0399 100644 --- a/src/s6-rc/s6-rc-oneshot-run.c +++ b/src/s6-rc/s6-rc-oneshot-run.c @@ -19,7 +19,7 @@ int main (int argc, char const *const *argv) { - char const *live = S6RC_LIVE_BASE ; + char const *live = S6RC_LIVEDIR ; unsigned int number ; int up ; int blocking = 0 ; diff --git a/src/s6-rc/s6-rc-update.c b/src/s6-rc/s6-rc-update.c index 1ceeba9..bec6bc5 100644 --- a/src/s6-rc/s6-rc-update.c +++ b/src/s6-rc/s6-rc-update.c @@ -41,8 +41,8 @@ #define dieusage() strerr_dieusage(100, USAGE) #define dienomem() strerr_diefu1sys(111, "build string") ; -static char const *live = S6RC_LIVE_BASE ; -static size_t livelen = sizeof(S6RC_LIVE_BASE) - 1 ; +static char const *live = S6RC_LIVEDIR ; +static size_t livelen = sizeof(S6RC_LIVEDIR) - 1 ; static unsigned int verbosity = 1 ; diff --git a/src/s6-rc/s6-rc.c b/src/s6-rc/s6-rc.c index 1dee5f9..8a3302e 100644 --- a/src/s6-rc/s6-rc.c +++ b/src/s6-rc/s6-rc.c @@ -38,7 +38,7 @@ struct pidindex_s } ; static unsigned int verbosity = 1 ; -static char const *live = S6RC_LIVE_BASE ; +static char const *live = S6RC_LIVEDIR ; static size_t livelen ; static pidindex_t *pidindex ; static unsigned int npids = 0 ; |
