diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-20 12:53:35 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2025-12-20 12:53:35 +0000 |
| commit | a065d815b1153ea38c58d5f64a2bfdfe31d330a4 (patch) | |
| tree | 88cab5669e1c5cb7c84e018645dcbe658db6a745 | |
| parent | e63674eed9e59448118a5bd74e04578f4042fe01 (diff) | |
| download | s6-rc-a065d815b1153ea38c58d5f64a2bfdfe31d330a4.tar.gz | |
Consistency of --force-essential option
| -rw-r--r-- | doc/s6-rc-set-change.html | 16 | ||||
| -rw-r--r-- | doc/s6-rc-set-fix.html | 4 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-change.c | 7 | ||||
| -rw-r--r-- | src/repo/s6-rc-set-fix.c | 6 | ||||
| -rw-r--r-- | src/repo/s6rc_repo_fixset.c | 6 |
5 files changed, 24 insertions, 15 deletions
diff --git a/doc/s6-rc-set-change.html b/doc/s6-rc-set-change.html index 0253af4..6e45c2e 100644 --- a/doc/s6-rc-set-change.html +++ b/doc/s6-rc-set-change.html @@ -26,7 +26,7 @@ the <a href="repodefs.html#sub">sub</a> of some services. <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> + s6-rc-set-change [ -v <em>verbosity</em> ] [ -r <em>repo</em> ] [ -E | -e ] [ -f | -I fail|pull|warn ] [ -n ] <em>set</em> <em>newsub</em> <em>services...</em> </pre> <ul> @@ -48,9 +48,17 @@ error messages will be written, and 2 or more adds informational messages. </dd> <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> -E, --no-force-essential </dt> + <dd> If a service needs to be moved to/from the <tt>always</tt> sub, fail and report +an error. This is the default. Services marked as <em>always</em> are normally defined +in the stores with <tt>flag-essential</tt>, and inconsistencies between essential +services should be resolved in the stores. </dd> + + <dt> -e, --force-essential </dt> + <dd> Move services to/from the <tt>always</tt> sub if they need to be. This option +should only be used temporarily until the store inconsistency is fixed. Be aware that +moving a service from <em>always</em> to <em>usable</em> or <em>masked</em> may +result in an unbootable set. </dd> <dt> -f, --ignore-dependencies </dt> <dd> Change <em>services...</em> to <em>newsub</em>, but do not change any other diff --git a/doc/s6-rc-set-fix.html b/doc/s6-rc-set-fix.html index e8c0fb3..eae3d69 100644 --- a/doc/s6-rc-set-fix.html +++ b/doc/s6-rc-set-fix.html @@ -67,7 +67,7 @@ the situation by making <tt>B</tt> <em>usable</em> (if <tt>A</tt> is <em>usable< or <em>masked</em> (if <tt>A</tt> is <em>masked</em>). This means that fewer services will be started at boot time than the set initially declared. This is the default. </dd> - <dt> -E, --no-force-essentials </dt> + <dt> -E, --no-force-essential </dt> <dd> If fixing a dependency inconsistency would imply moving a service down from the <em>always</em> sub, or up to the <em>always</em> sub, when its service definition directory does not declare it as essential, do not attempt fixing it and fail the operation. @@ -75,7 +75,7 @@ This is the default. If such a situation occurs, it means that the set of servic provided in the <a href="repodefs.html#sub">stores</a> is not consistent, and that is what should be fixed. </dd> - <dt> -e, --force-essentials </dt> + <dt> -e, --force-essential </dt> <dd> If fixing a dependency inconsistency would imply moving a service down from the <em>always</em> sub, or up to the <em>always</em> sub, when its service definition directory does not declare it as essential, do it, even though it goes against a diff --git a/src/repo/s6-rc-set-change.c b/src/repo/s6-rc-set-change.c index 32a738f..439a865 100644 --- a/src/repo/s6-rc-set-change.c +++ b/src/repo/s6-rc-set-change.c @@ -19,7 +19,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 newsub services..." +#define USAGE "s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E | -e ] [ -f | -I fail|pull|warn ] [ -n ] set newsub services..." #define dieusage() strerr_dieusage(100, USAGE) enum golb_e @@ -45,7 +45,8 @@ struct subname_s static gol_bool const rgolb[] = { - { .so = 'E', .lo = "force-essential", .clear = 0, .set = GOLB_FORCE_ESSENTIAL }, + { .so = 'E', .lo = "no-force-essential", .clear = GOLB_FORCE_ESSENTIAL, .set = 0 }, + { .so = 'e', .lo = "force-essential", .clear = 0, .set = GOLB_FORCE_ESSENTIAL }, { .so = 'f', .lo = "ignore-dependencies", .clear = 0, .set = GOLB_IGNORE_DEPENDENCIES }, { .so = 'n', .lo = "dry-run", .clear = 0, .set = GOLB_DRYRUN } } ; @@ -127,7 +128,7 @@ int main (int argc, char const *const *argv) newsub = bsearch(argv[1], accepted_subs, sizeof(accepted_subs)/sizeof(struct subname_s), sizeof(struct subname_s), &subname_cmp) ; if (!newsub) strerr_dief2x(100, "unrecognized state change directive:", argv[1]) ; if (newsub->sub == 3 && !(wgolb & GOLB_FORCE_ESSENTIAL)) - strerr_diefu1x(100, " artificially mark a service as essential without --force-essential") ; + strerr_diefu1x(100, "artificially mark a service as essential without --force-essential") ; for (unsigned int i = 2 ; i < argc ; i++) s6rc_repo_sanitize_svname(argv[i]) ; tain_now_g() ; diff --git a/src/repo/s6-rc-set-fix.c b/src/repo/s6-rc-set-fix.c index cb9c1e8..6205024 100644 --- a/src/repo/s6-rc-set-fix.c +++ b/src/repo/s6-rc-set-fix.c @@ -15,7 +15,7 @@ enum golb_e { GOLB_FIXUP = 0x01, - GOLB_FORCE_ESSENTIALS = 0x02, + GOLB_FORCE_ESSENTIAL = 0x02, GOLB_DRYRUN = 0x04, } ; @@ -48,8 +48,8 @@ int main (int argc, char const **argv) { { .so = 'u', .lo = "fix-up", .clear = 0, .set = GOLB_FIXUP }, { .so = 'd', .lo = "fix-down", .clear = GOLB_FIXUP, .set = 0 }, - { .so = 'E', .lo = "no-force-essentials", .clear = GOLB_FORCE_ESSENTIALS, .set = 0 }, - { .so = 'e', .lo = "force-essentials", .clear = 0, .set = GOLB_FORCE_ESSENTIALS }, + { .so = 'E', .lo = "no-force-essential", .clear = GOLB_FORCE_ESSENTIAL, .set = 0 }, + { .so = 'e', .lo = "force-essential", .clear = 0, .set = GOLB_FORCE_ESSENTIAL }, { .so = 'n', .lo = "dry-run", .clear = 0, .set = GOLB_DRYRUN }, } ; static gol_arg const rgola[] = diff --git a/src/repo/s6rc_repo_fixset.c b/src/repo/s6rc_repo_fixset.c index 4a42992..45cc36e 100644 --- a/src/repo/s6rc_repo_fixset.c +++ b/src/repo/s6rc_repo_fixset.c @@ -28,7 +28,7 @@ static inline int s6rc_repo_fixsub (char const *repo, char const *set, uint8_t s { tomove[j] = byname[bads[j]] ; if (verbosity >= 2) - strerr_warni(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": need to ", options & 1 ? "up" : "down", "fix service ", sa->s + tomove[j].pos, " from ", s6rc_repo_subnames[tomove[j].sub], " to ", s6rc_repo_subnames[sub]) ; + strerr_warni(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": ", options & 1 ? "up" : "down", "fix service ", sa->s + tomove[j].pos, " from ", s6rc_repo_subnames[tomove[j].sub], " to ", s6rc_repo_subnames[sub]) ; if (tomove[j].sub == 0 && verbosity) strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will automatically be unmasked by an upfix to ", s6rc_repo_subnames[sub]) ; if (tomove[j].sub == 3) @@ -36,10 +36,10 @@ static inline int s6rc_repo_fixsub (char const *repo, char const *set, uint8_t s if (!(options & 2)) { if (options & 4) - strerr_warnw(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": service ", sa->s + tomove[j].pos, " is marked as essential and cannot be downfixed. You will need --force-essential") ; + strerr_warnw(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": service ", sa->s + tomove[j].pos, " is marked as essential and cannot be downfixed (--no-force-essential") ; else { - strerr_warnf(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": service ", sa->s + tomove[j].pos, " is marked as essential and cannot be downfixed. If you are sure of yourself, try --force-essential") ; + strerr_warnf(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": service ", sa->s + tomove[j].pos, " is marked as essential and cannot be downfixed (--no-force-essential") ; e = 1 ; goto err ; } |
