diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/s6-frontend/main.help.txt | 1 | ||||
| -rw-r--r-- | src/s6-frontend/repository.help.txt | 4 | ||||
| -rw-r--r-- | src/s6-frontend/repository_init.c | 17 | ||||
| -rw-r--r-- | src/s6-frontend/repository_sync.c | 17 | ||||
| -rw-r--r-- | src/s6-frontend/s6-frontend-internal.h | 2 | ||||
| -rw-r--r-- | src/s6-frontend/s6-frontend.c | 6 | ||||
| -rw-r--r-- | src/s6-frontend/set.help.txt | 2 | ||||
| -rw-r--r-- | src/s6-frontend/set_apply.c | 6 | ||||
| -rw-r--r-- | src/s6-frontend/set_commit.c | 6 |
9 files changed, 19 insertions, 42 deletions
diff --git a/src/s6-frontend/main.help.txt b/src/s6-frontend/main.help.txt index 7837152..2b7e920 100644 --- a/src/s6-frontend/main.help.txt +++ b/src/s6-frontend/main.help.txt @@ -34,4 +34,5 @@ Global options: -c BOOTDB --bootdb=BOOTDB live database the system is booting on --stmpdir=STMPDIR root-only temporary directory --storelist=LIST list of service stores + --fdholder-user=USER the s6-fdholderd user embedded in service databases diff --git a/src/s6-frontend/repository.help.txt b/src/s6-frontend/repository.help.txt index 3a9ee1e..a418dbe 100644 --- a/src/s6-frontend/repository.help.txt +++ b/src/s6-frontend/repository.help.txt @@ -11,10 +11,8 @@ Subcommands: s6 repository init options: -f --force Overwrite existing repository -U --update-stores Update existing repository with new stores - -h USER --fdholder-user Set USER as reference fdholder owner -s6 repository sync options: - -h USER --fdholder-user Set USER as reference fdholder owner +s6 repository sync options: none s6 repository list options: none diff --git a/src/s6-frontend/repository_init.c b/src/s6-frontend/repository_init.c index 747c481..a4f6b8b 100644 --- a/src/s6-frontend/repository_init.c +++ b/src/s6-frontend/repository_init.c @@ -20,12 +20,6 @@ enum golb_e GOLB_UPDATE = 0x02, } ; -enum gola_e -{ - GOLA_FDHUSER, - GOLA_N -} ; - void repository_init (char const *const *argv) { static gol_bool const rgolb[] = @@ -33,18 +27,13 @@ void repository_init (char const *const *argv) { .so = 'f', .lo = "force", .clear = 0, .set = GOLB_FORCE }, { .so = 'U', .lo = "update-stores", .clear = 0, .set = GOLB_UPDATE }, } ; - static gol_arg const rgola[] = - { - { .so = 'h', .lo = "fdholder-user", .i = GOLA_FDHUSER }, - } ; uint64_t wgolb = 0 ; unsigned int m = 0 ; unsigned int n = 0 ; - char const *wgola[GOLA_N] = { 0 } ; size_t len ; char fmtv[UINT_FMT] ; - argv += GOL_argv(argv, rgolb, rgola, &wgolb, wgola) ; + argv += gol_argv(argv, rgolb, sizeof(rgolb) / sizeof(gol_bool), 0, 0, &wgolb, 0) ; len = strlen(g->dirs.stol) ; char storage[len+1] ; @@ -64,10 +53,10 @@ void repository_init (char const *const *argv) newargv[m++] = g->dirs.repo ; if (wgolb & GOLB_FORCE) newargv[m++] = "-f" ; if (wgolb & GOLB_UPDATE) newargv[m++] = "-U" ; - if (wgola[GOLA_FDHUSER]) + if (g->fdhuser && g->fdhuser[0]) { newargv[m++] = "-h" ; - newargv[m++] = wgola[GOLA_FDHUSER] ; + newargv[m++] = g->fdhuser ; } newargv[m++] = "--" ; len = 0 ; diff --git a/src/s6-frontend/repository_sync.c b/src/s6-frontend/repository_sync.c index f3e25df..4f4fca3 100644 --- a/src/s6-frontend/repository_sync.c +++ b/src/s6-frontend/repository_sync.c @@ -7,23 +7,12 @@ #include "s6-frontend-internal.h" -enum gola_e -{ - GOLA_FDHUSER, - GOLA_N -} ; - void repository_sync (char const *const *argv) { - static gol_arg const rgola[] = - { - { .so = 'h', .lo = "fdholder-user", .i = GOLA_FDHUSER }, - } ; unsigned int m = 0 ; - char const *wgola[GOLA_N] = { 0 } ; char fmtv[UINT_FMT] ; - argv += gol_argv(argv, 0, 0, rgola, GOLA_N, 0, wgola) ; + argv += gol_argv(argv, 0, 0, 0, 0, 0, 0) ; char const *newargv[9] ; newargv[m++] = S6RC_EXTBINPREFIX "s6-rc-repo-sync" ; @@ -35,10 +24,10 @@ void repository_sync (char const *const *argv) } newargv[m++] = "-r" ; newargv[m++] = g->dirs.repo ; - if (wgola[GOLA_FDHUSER]) + if (g->fdhuser && g->fdhuser[0]) { newargv[m++] = "-h" ; - newargv[m++] = wgola[GOLA_FDHUSER] ; + newargv[m++] = g->fdhuser ; } newargv[m++] = "--" ; newargv[m++] = 0 ; diff --git a/src/s6-frontend/s6-frontend-internal.h b/src/s6-frontend/s6-frontend-internal.h index 587b4e2..4089c15 100644 --- a/src/s6-frontend/s6-frontend-internal.h +++ b/src/s6-frontend/s6-frontend-internal.h @@ -119,6 +119,7 @@ struct global_s { unsigned int verbosity ; s6f_confdirs dirs ; + char const *fdhuser ; stralloc userstorage ; uint8_t isuser : 1 ; uint8_t istty : 1 ; @@ -136,6 +137,7 @@ struct global_s .stmp = S6_FRONTEND_STMPDIR, \ .stol = S6_FRONTEND_STORELIST, \ }, \ + .fdhuser = S6_FRONTEND_FDHUSER, \ .userstorage = STRALLOC_ZERO, \ .isuser = 0, \ .istty = 0, \ diff --git a/src/s6-frontend/s6-frontend.c b/src/s6-frontend/s6-frontend.c index 9e649a7..ff78f8b 100644 --- a/src/s6-frontend/s6-frontend.c +++ b/src/s6-frontend/s6-frontend.c @@ -22,7 +22,7 @@ #define USAGE "s6 [ generic options ] command [ command options ] command_arguments... Type \"s6 help\" for details." #define dieusage() strerr_dieusage(100, USAGE) -#define CLEANUP_MODIF "scandir\0livedir\0repodir\0bootdb\0stmpdir\0storelist\0verbosity" +#define CLEANUP_MODIF "scandir\0livedir\0repodir\0bootdb\0stmpdir\0storelist\0verbosity\0fdhuser" enum golb_e { @@ -40,6 +40,7 @@ enum gola_e GOLA_STMPDIR, GOLA_STORELIST, GOLA_VERBOSITY, + GOLA_FDHUSER, GOLA_COLOR, GOLA_N } ; @@ -114,6 +115,7 @@ int main (int argc, char const *const *argv) { .so = 0, .lo = "stmpdir", .i = GOLA_STMPDIR }, { .so = 0, .lo = "storelist", .i = GOLA_STORELIST }, { .so = 'v', .lo = "verbosity", .i = GOLA_VERBOSITY }, + { .so = 0, .lo = "fdholder-user", .i = GOLA_FDHUSER }, { .so = 0, .lo = "color", .i = GOLA_COLOR }, } ; static struct command_s const commands[] = @@ -151,6 +153,7 @@ int main (int argc, char const *const *argv) [GOLA_STMPDIR] = getenv("stmpdir"), [GOLA_STORELIST] = getenv("storelist"), [GOLA_VERBOSITY] = getenv("verbosity"), + [GOLA_FDHUSER] = getenv("fdhuser"), [GOLA_COLOR] = 0 } ; PROG = "s6-frontend" ; @@ -173,6 +176,7 @@ int main (int argc, char const *const *argv) if (wgola[GOLA_BOOTDB]) g->dirs.boot = wgola[GOLA_BOOTDB] ; if (wgola[GOLA_STMPDIR]) g->dirs.stmp = wgola[GOLA_STMPDIR] ; if (wgola[GOLA_STORELIST]) g->dirs.stol = wgola[GOLA_STORELIST] ; + if (wgola[GOLA_FDHUSER]) g->fdhuser = wgola[GOLA_FDHUSER] ; { int force_color = 0 ; diff --git a/src/s6-frontend/set.help.txt b/src/s6-frontend/set.help.txt index 9113f34..1da3a8a 100644 --- a/src/s6-frontend/set.help.txt +++ b/src/s6-frontend/set.help.txt @@ -49,13 +49,11 @@ s6 set commit options: -f --force compile db even if up-to-date -K --keep-old keep old db if any, print its path to stdout -D BUN --default-bundle=BUN name of the bundle containing enabled+essential services - -h USER --fdholder-user=USER user for the s6-fdholderd process (default: root - it's fine) -s SET --set=SET commit set SET (default: current) s6 set apply options: -b --block block if another s6-rc is running (default: fail) -D BUN --default-bundle=BUN name of the bundle containing enabled+essential services - -h USER --fdholder-user=USER user for the s6-fdholderd process (default: root - it's fine) -f CONVFILE --conversion-file=CONVFILE use CONVFILE when updating the service db (default: none) -s SET --set=SET apply set SET (default: current) -t TIMEOUT --timeout=TIMEOUT fail after TIMEOUT milliseconds (default: 0 (=infinite)) diff --git a/src/s6-frontend/set_apply.c b/src/s6-frontend/set_apply.c index b017212..85078ec 100644 --- a/src/s6-frontend/set_apply.c +++ b/src/s6-frontend/set_apply.c @@ -17,7 +17,6 @@ enum golb_e enum gola_e { GOLA_DEFBUNDLE, - GOLA_FDHUSER, GOLA_CONVFILE, GOLA_SET, GOLA_TIMEOUT, @@ -33,7 +32,6 @@ void set_apply (char const *const *argv) static gol_arg const rgola[] = { { .so = 'D', .lo = "default-bundle", .i = GOLA_DEFBUNDLE }, - { .so = 'h', .lo = "fdholder-user", .i = GOLA_FDHUSER }, { .so = 'f', .lo = "conversion-file", .i = GOLA_CONVFILE }, { .so = 's', .lo = "set", .i = GOLA_SET }, { .so = 't', .lo = "timeout", .i = GOLA_TIMEOUT }, @@ -71,10 +69,10 @@ void set_apply (char const *const *argv) newargv[m++] = g->dirs.repo ; newargv[m++] = "-D" ; newargv[m++] = wgola[GOLA_DEFBUNDLE] ; - if (wgola[GOLA_FDHUSER]) + if (g->fdhuser && g->fdhuser[0]) { newargv[m++] = "-h" ; - newargv[m++] = wgola[GOLA_FDHUSER] ; + newargv[m++] = g->fdhuser ; } newargv[m++] = "--" ; newargv[m++] = wgola[GOLA_SET] ; diff --git a/src/s6-frontend/set_commit.c b/src/s6-frontend/set_commit.c index 3e0fae2..eb98bd5 100644 --- a/src/s6-frontend/set_commit.c +++ b/src/s6-frontend/set_commit.c @@ -17,7 +17,6 @@ enum golb_e enum gola_e { GOLA_DEFBUNDLE, - GOLA_FDHUSER, GOLA_SET, GOLA_N } ; @@ -32,7 +31,6 @@ void set_commit (char const *const *argv) static gol_arg const rgola[] = { { .so = 'D', .lo = "default-bundle", .i = GOLA_DEFBUNDLE }, - { .so = 'h', .lo = "fdholder-user", .i = GOLA_FDHUSER }, { .so = 's', .lo = "set", .i = GOLA_SET }, } ; @@ -59,10 +57,10 @@ void set_commit (char const *const *argv) newargv[m++] = wgola[GOLA_DEFBUNDLE] ; if (wgolb & GOLB_FORCE) newargv[m++] = "-f" ; if (wgolb & GOLB_KEEPOLD) newargv[m++] = "-K" ; - if (wgola[GOLA_FDHUSER]) + if (g->fdhuser && g->fdhuser[0]) { newargv[m++] = "-h" ; - newargv[m++] = wgola[GOLA_FDHUSER] ; + newargv[m++] = g->fdhuser ; } newargv[m++] = "--" ; newargv[m++] = wgola[GOLA_SET] ; |
