aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--doc/index.html6
-rw-r--r--doc/s6-rc-set-change.html105
-rw-r--r--doc/upgrade.html2
-rw-r--r--src/repo/s6-rc-set-change.c4
-rw-r--r--src/repo/s6rc_repo_badsub.c10
6 files changed, 115 insertions, 14 deletions
diff --git a/INSTALL b/INSTALL
index 31166b4..b18f8e7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,7 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 3.81 or later
- skalibs version 2.14.5.0 or later: https://skarnet.org/software/skalibs/
- - execline version 2.9.7.1 or later: https://skarnet.org/software/execline/
+ - execline version 2.9.8.0 or later: https://skarnet.org/software/execline/
- s6 version 2.13.3.0 or later: https://skarnet.org/software/s6/
This software will run on any operating system that implements
diff --git a/doc/index.html b/doc/index.html
index 9ede9bc..9a40af7 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -52,7 +52,7 @@ scripts are also run in a controlled environment.
2.14.5.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs library. </li>
<li> <a href="//skarnet.org/software/execline/">execline</a> version
-2.9.7.1 or later. It's a build-time <em>and</em> run-time requirement. </li>
+2.9.8.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
<li> <a href="//skarnet.org/software/s6/">s6</a> version
2.13.3.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
</ul>
@@ -68,7 +68,7 @@ requirement if you link against the shared version of the skalibs library. </li>
<ul>
<li> The current released version of s6-rc is
-<a href="s6-rc-0.6.0.0.tar.gz">0.5.7.0</a>.
+<a href="s6-rc-0.6.0.0.tar.gz">0.6.0.0</a>.
You can access its checksum <a href="s6-rc-0.6.0.0.tar.gz.sha256">here</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-rc/">s6-rc
@@ -138,7 +138,7 @@ the previous versions of s6-rc and the current one. </li>
<li> <a href="s6-rc-repo-set-new.html">The <tt>s6-rc-set-new</tt> program</a> </li>
<li> <a href="s6-rc-repo-set-copy.html">The <tt>s6-rc-set-copy</tt> program</a> </li>
<li> <a href="s6-rc-repo-set-delete.html">The <tt>s6-rc-set-delete</tt> program</a> </li>
- <li> <a href="s6-rc-repo-set-changestate.html">The <tt>s6-rc-set-changestate</tt> program</a> </li>
+ <li> <a href="s6-rc-repo-set-change.html">The <tt>s6-rc-set-change</tt> program</a> </li>
<li> <a href="s6-rc-repo-set-commit.html">The <tt>s6-rc-set-commit</tt> program</a> </li>
</ul>
diff --git a/doc/s6-rc-set-change.html b/doc/s6-rc-set-change.html
new file mode 100644
index 0000000..5a0d41b
--- /dev/null
+++ b/doc/s6-rc-set-change.html
@@ -0,0 +1,105 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>s6-rc: the s6-rc-set-change program</title>
+ <meta name="Description" content="s6-rc: the s6-rc-set-change program" />
+ <meta name="Keywords" content="s6-rc s6-rc-set-change repo set sub change services" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">s6-rc</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The s6-rc-set-change program </h1>
+
+<p>
+ s6-rc-set-change modifies a <a href="repodefs.html#set">set</a> by changing
+the <a href="repodefs.html#sub">sub</a> of some services.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ s6-rc-set-change [ -v <em>verbosity</em> ] [ -r <em>repo</em> ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] <em>set</em> <em>newsub</em> <em>services...</em>
+</pre>
+
+<ul>
+ <li> s6-rc-set-change operates on <a href="repodefs.html#set">set</a> <em>set</em> in <a href="repodefs.html#repository">repository</a> <em>repo</em>. </li>
+ <li> It attempts to move all the services listed in <em>services...</em> into <a href="repodefs.html#sub">sub</a> <em>newsub</em>. </li>
+ <li> It exits 0. </li>
+</ul>
+
+<h2> Options </h2>
+
+<dl>
+ <dt> -v <em>verbosity</em>, --verbosity=<em>verbosity</em> </dt>
+ <dd> Be more or less verbose. The default is <strong>1</strong>, which means
+that error messages and warnings will be written to stderr. 0 means that only
+error messages will be written, and 2 or more adds informational messages. </dd>
+
+ <dt> -r <em>repo</em>, --repository=<em>repo</em> </dt>
+ <dd> Use the repository in <em>repo</em>, which must exist. Default is
+<strong>/var/lib/s6-rc/repository</strong>.
+ </dd>
+
+ <dt> -E, --force-essential </dt>
+ <dd> This option is necessary in order if <em>newsub</em> is <tt>always</tt>.
+Without that option, s6-rc-set-change refuses to set services to <tt>always</tt>. </dd>
+
+ <dt> -f, --ignore-dependencies </dt>
+ <dd> Change <em>services...</em> to <em>newsub</em>, but do not change any other
+services, even if the dependency graph would normally mandate it. This may result
+in an inconsistent set that you cannot commit. </dd>
+</dl>
+
+ <dt> -I <em>action</em>, --if-dependencies-found=<em>action</em> </dt>
+ <dd> Determine what to do if a dependency would make the set inconsistent.
+For instance, if service <tt>A</tt> depends on service <tt>B</tt>, they are both
+in the <tt>latent</tt> sub, and you are trying to change <tt>A</tt> to <tt>active</tt>
+without mentioning <tt>B</tt>, this would not work: in order to be brought up at
+boot time, <tt>A</tt> would first need <tt>B</tt> to also be brought up at boot time,
+so <tt>A</tt> can only be <tt>active</tt> if <tt>B</tt> also is. In that situation,
+what s6-rc-set-change does depends on the value of <em>action</em>:
+ <ul>
+ <li> <tt>fail</tt>: print an error message and exit 1. </li>
+ <li> <tt>warn</tt>: print a warning message and proceed. This is the default. </li>
+ <li> <tt>pull</tt>: print a warning message and pull the dependencies of
+<em>services...</em> into <em>newsub</tt>. (Or the reverse dependencies, if
+you're trying to disable or mask services. </li>
+ </ul>
+ The warning messages are not printed if <em>verbosity</em> is 0. </dd>
+
+ <dt> -n, --dry-run </dt>
+ <dd> Check whether the command would succeed, print warning or error messages if
+appropriate, but do not perform the actual modifications. </dd>
+
+<h2> Exit codes </h2>
+
+<dl>
+ <dt> 0 </dt> <dd> Success. </dd>
+ <dt> 1 </dt> <dd> <tt>-I fail</tt> was given and dependencies prevented <em>services...</em>
+from being changed to <em>newsub</em>. </dd>
+ <dt> 3 </dt> <dd> A service in <em>services...</em> was not found in the reference database. </dt>
+ <dt> 4 </dt> <dd> Invalid or corrupted reference database. </dd>
+ <dt> 100 </dt> <dd> Incorrect usage. </dd>
+ <dt> 102 </dt> <dd> Inconsistent repository. </dd>
+ <dt> 111 </dt> <dd> System call failed. </dd>
+</dl>
+
+<h2> Notes </h2>
+
+<ul>
+ <li> s6-rc-set-change is the bread and butter of <em>repo</em> operations. It is how users
+can tailor the set of services they want to be enabled at boot time. </li>
+ <li> Once a change has been effected, and the command says that the set is consistent,
+it needs to be <a href="s6-rc-set-commit">committed</a>. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index e77f2d6..dba10f9 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -36,7 +36,7 @@ minor and bugfix version changes.
<li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
dependency bumped to 2.14.5.0. </li>
<li> <a href="//skarnet.org/software/execline/">execline</a>
-dependency bumped to 2.9.7.1. </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>
</ul>
diff --git a/src/repo/s6-rc-set-change.c b/src/repo/s6-rc-set-change.c
index 2758fa6..d5ca4ed 100644
--- a/src/repo/s6-rc-set-change.c
+++ b/src/repo/s6-rc-set-change.c
@@ -17,7 +17,7 @@
#include <s6-rc/config.h>
#include <s6-rc/s6rc.h>
-#define USAGE "s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] set newstate services..."
+#define USAGE "s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] set newsub services..."
#define dieusage() strerr_dieusage(100, USAGE)
enum golb_e
@@ -180,7 +180,7 @@ int main (int argc, char const *const *argv)
{
uint32_t const *bads = genalloc_s(uint32_t, &indices) ;
uint32_t badn = genalloc_len(uint32_t, &indices) ;
- if (verbosity)
+ if (verbosity || !forcelevel)
{
char const *arg[10 + (badn << 1)] ;
arg[0] = PROG ;
diff --git a/src/repo/s6rc_repo_badsub.c b/src/repo/s6rc_repo_badsub.c
index 69697eb..246396c 100644
--- a/src/repo/s6rc_repo_badsub.c
+++ b/src/repo/s6rc_repo_badsub.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <skalibs/posixplz.h>
+#include <skalibs/bytestr.h>
#include <skalibs/direntry.h>
#include <skalibs/strerr.h>
#include <skalibs/stralloc.h>
@@ -13,11 +14,6 @@
#include <s6-rc/repo.h>
-static int strqcmp (void const *a, void const *b)
-{
- return strcmp(*(char const *const *)a, *(char const *const *)b) ;
-}
-
int s6rc_repo_badsub (char const *repo, char const *set, char const **services, uint32_t n, uint8_t newsub, uint8_t what, s6rc_repo_sv const *svlist, uint32_t ntot, stralloc *sa, genalloc *badga)
{
int sawasnull = !!sa->s ;
@@ -33,7 +29,7 @@ int s6rc_repo_badsub (char const *repo, char const *set, char const **services,
mid = genalloc_len(size_t, &fulldeps) ;
if (newsub > 0 && (what & 2) && s6rc_repo_listalldeps(repo, services, n, sa, &fulldeps, 1)) goto err ;
- qsort(services, n, sizeof(char const *), &strqcmp) ;
+ qsort(services, n, sizeof(char const *), &str_cmp) ;
fulln = genalloc_len(size_t, &fulldeps) ;
ind = genalloc_s(size_t, &fulldeps) ;
@@ -41,7 +37,7 @@ int s6rc_repo_badsub (char const *repo, char const *set, char const **services,
{
s6rc_repo_sv *p ;
char const *cur = sa->s + ind[i] ;
- if (bsearch(&cur, services, n, sizeof(char const *), &strqcmp)) continue ;
+ if (bsearch(&cur, services, n, sizeof(char const *), &str_cmp)) continue ;
p = bsearchr(cur, svlist, ntot, sizeof(s6rc_repo_sv), &s6rc_repo_sv_bcmpr, sa->s) ;
if (!p)
{