aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-12-24 11:51:47 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2025-12-24 11:51:47 +0000
commit50fd489b3dd53740ac2e2b024244b98967859d7b (patch)
tree883a8488072573993090a00920695e0ee40666f6
parent97ed22b1bb075cb539e78fae2169ec56d3e8557b (diff)
downloads6-frontend-50fd489b3dd53740ac2e2b024244b98967859d7b.tar.gz
Save before experimenting with help processing system...
-rw-r--r--package/targets.mak10
-rw-r--r--src/s6-frontend/deps-exe/s6-frontend1
-rw-r--r--src/s6-frontend/help.c27
-rw-r--r--src/s6-frontend/live.help.txt1
-rw-r--r--src/s6-frontend/live_help.c18
-rw-r--r--src/s6-frontend/main.help.txt34
-rw-r--r--src/s6-frontend/process.help.txt40
-rw-r--r--src/s6-frontend/process_help.c18
-rw-r--r--src/s6-frontend/process_kill.c4
-rw-r--r--src/s6-frontend/process_restart.c4
-rw-r--r--src/s6-frontend/process_startstop.c2
-rw-r--r--src/s6-frontend/repository.help.txt1
-rw-r--r--src/s6-frontend/repository_help.c18
-rw-r--r--src/s6-frontend/s6-frontend.c8
-rw-r--r--src/s6-frontend/set.help.txt1
-rw-r--r--src/s6-frontend/set_help.c18
-rw-r--r--src/s6-frontend/system.help.txt1
-rw-r--r--src/s6-frontend/system_help.c18
-rwxr-xr-xtools/help2c.sh28
19 files changed, 126 insertions, 126 deletions
diff --git a/package/targets.mak b/package/targets.mak
index 13bab6f..25321a7 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -5,3 +5,13 @@ s6-frontend
LIBEXEC_TARGETS := \
s6-frontend-helper-kill \
+EXTRA_TARGETS := \
+src/s6-frontend/live_help.c \
+src/s6-frontend/main_help.c \
+src/s6-frontend/process_help.c \
+src/s6-frontend/repository_help.c \
+src/s6-frontend/set_help.c \
+src/s6-frontend/system_help.c \
+
+%_help.c: %.help.txt
+ exec ./tools/help2c.sh $* < $< > $@
diff --git a/src/s6-frontend/deps-exe/s6-frontend b/src/s6-frontend/deps-exe/s6-frontend
index 2e7af62..3c55079 100644
--- a/src/s6-frontend/deps-exe/s6-frontend
+++ b/src/s6-frontend/deps-exe/s6-frontend
@@ -6,6 +6,7 @@ live_startstop.o
live_status.o
live_start_everything.o
live_stop_everything.o
+main_help.o
process.o
process_help.o
process_kill.o
diff --git a/src/s6-frontend/help.c b/src/s6-frontend/help.c
deleted file mode 100644
index f9994b2..0000000
--- a/src/s6-frontend/help.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include <s6-frontend/config.h>
-#include "s6-frontend-internal.h"
-
-#define MAIN_HELP_MESSAGE "This is the main help message.\n"
-
-void version (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, "s6-frontend v" S6_FRONTEND_VERSION "\n"))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
-
-void help (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, MAIN_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
diff --git a/src/s6-frontend/live.help.txt b/src/s6-frontend/live.help.txt
new file mode 100644
index 0000000..6af99c8
--- /dev/null
+++ b/src/s6-frontend/live.help.txt
@@ -0,0 +1 @@
+This is the live help message.
diff --git a/src/s6-frontend/live_help.c b/src/s6-frontend/live_help.c
deleted file mode 100644
index ca52623..0000000
--- a/src/s6-frontend/live_help.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include "s6-frontend-internal.h"
-
-#define LIVE_HELP_MESSAGE "This is the live help message.\n"
-
-void live_help (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, LIVE_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
diff --git a/src/s6-frontend/main.help.txt b/src/s6-frontend/main.help.txt
new file mode 100644
index 0000000..c769504
--- /dev/null
+++ b/src/s6-frontend/main.help.txt
@@ -0,0 +1,34 @@
+Usage: s6 [ global options ] command subcommand [ subcommand options ] [ arguments... ]
+
+For details about a command and its options, try: s6 command help (e.g.: s6 live help)
+
+
+Commands:
+
+ help this message
+ version print the version of this package
+
+ system boot and shutdown the system
+ live start and stop services and their dependencies
+ process control individual long-running processes
+
+ set manipulate sets of services (offline, to later install them live)
+ repository manipulate the service repository itself
+
+
+Global options:
+
+ -h --help equivalent to "s6 help"
+ -V --version equivalent to "s6 version"
+
+ --color=yes|no|auto display fancy or boring-but-parsable text.
+ auto is the default: fancy if in a terminal.
+
+ These options override the values set in s6-frontend.conf:
+ -v V --verbosity=V verbosity (0 is terse, 1 is normal/default, more is verbose)
+ -s SCANDIR --scandir=SCANDIR where s6-svscan is running
+ -l LIVEDIR --livedir=LIVEDIR s6-rc live directory
+ -r REPODIR --repodir=REPODIR s6-rc service set repository
+ -c BOOTDB --bootdb=BOOTDB live database the system is booting on
+ --stmpdir=STMPDIR root-only temporary directory
+
diff --git a/src/s6-frontend/process.help.txt b/src/s6-frontend/process.help.txt
new file mode 100644
index 0000000..0b5208b
--- /dev/null
+++ b/src/s6-frontend/process.help.txt
@@ -0,0 +1,40 @@
+Usage: s6 process subcommand [ options ] services...
+
+Subcommands:
+
+ help this message
+
+ start start a supervised process without impacting its official state
+ stop stop a supervised process without impacting its official state
+ restart restart a supervised process
+ kill send a signal to a supervised process
+ status read the status of a supervised process
+
+
+s6 process start and s6 process stop options:
+
+ -P --no-permanent don't override the official state if the daemon dies
+ (i.e. if the service manager says the service should be
+ down, do not restart the daemon; if it says the service
+ should be up, do restart it). This is the default.
+ -p --permanent override the official state: "s6 process start foo" will
+ keep foo up even if the live status says otherwise
+ -W --no-wait exit without waiting for service readiness
+ -w --wait only exit once the daemon is ready or confirmed dead
+ -t TIMEOUT --timeout=TIMEOUT if -w: give up if not ready after TIMEOUT milliseconds
+
+
+s6 process restart options:
+
+ -W --no-wait exit without waiting for service readiness
+ -w --wait only exit once the daemon is ready again
+ -t TIMEOUT --timeout=TIMEOUT if -w: give up if not ready after TIMEOUT milliseconds
+
+
+s6 process kill options:
+
+ -W --no-wait exit without waiting for service readiness
+ -w --wait only exit once the daemon is ready again, if applicable
+ -t TIMEOUT --timeout=TIMEOUT if -w: give up if not ready after TIMEOUT milliseconds
+ -s SIGNAL --signal=SIGNAL send signal SIGNAL rather than the default (prob. SIGTERM)
+
diff --git a/src/s6-frontend/process_help.c b/src/s6-frontend/process_help.c
deleted file mode 100644
index 7399565..0000000
--- a/src/s6-frontend/process_help.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include "s6-frontend-internal.h"
-
-#define PROCESS_HELP_MESSAGE "This is the process help message.\n"
-
-void process_help (char const *const *argv)
-{
- if (!buffer_putsflush(buffer_1, PROCESS_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- (void)argv ;
- _exit(0) ;
-}
diff --git a/src/s6-frontend/process_kill.c b/src/s6-frontend/process_kill.c
index 6285e70..73820f2 100644
--- a/src/s6-frontend/process_kill.c
+++ b/src/s6-frontend/process_kill.c
@@ -17,7 +17,7 @@
#include "s6f.h"
#include "s6-frontend-internal.h"
-#define USAGE "s6 process kill [ --signal=sig ] [ --timeout=millisecs ] [ --wait | --nowait ] services..."
+#define USAGE "s6 process kill [ --signal=sig ] [ --timeout=millisecs ] [ --wait | --no-wait ] services..."
#define dieusage() strerr_dieusage(100, USAGE)
static void process_kill_hack_kill (int sig, char const *const *argv, unsigned int argc, int dowait, unsigned int timeout) gccattr_noreturn ;
@@ -86,7 +86,7 @@ void process_kill (char const *const *argv)
{
static gol_bool const rgolb[] =
{
- { .so = 'W', .lo = "nowait", .clear = GOLB_WAIT, .set = 0 },
+ { .so = 'W', .lo = "no-wait", .clear = GOLB_WAIT, .set = 0 },
{ .so = 'w', .lo = "wait", .clear = 0, .set = GOLB_WAIT },
} ;
static gol_arg const rgola[] =
diff --git a/src/s6-frontend/process_restart.c b/src/s6-frontend/process_restart.c
index d23ced2..a1f6a9b 100644
--- a/src/s6-frontend/process_restart.c
+++ b/src/s6-frontend/process_restart.c
@@ -9,7 +9,7 @@
#include "s6-frontend-internal.h"
-#define USAGE "s6 process restart [ -W|--nowait | -w|--wait ] [ -t timeout | --timeout=timeout ] services..."
+#define USAGE "s6 process restart [ -W|--no-wait | -w|--wait ] [ -t timeout | --timeout=timeout ] services..."
#define dieusage() strerr_dieusage(100, USAGE)
enum golb_e
@@ -27,7 +27,7 @@ void process_restart (char const *const *argv)
{
static gol_bool const rgolb[] =
{
- { .so = 'W', .lo = "nowait", .clear = GOLB_WAIT, .set = 0 },
+ { .so = 'W', .lo = "no-wait", .clear = GOLB_WAIT, .set = 0 },
{ .so = 'w', .lo = "wait", .clear = 0, .set = GOLB_WAIT },
} ;
static gol_arg const rgola[] =
diff --git a/src/s6-frontend/process_startstop.c b/src/s6-frontend/process_startstop.c
index 75bf5a0..556ba06 100644
--- a/src/s6-frontend/process_startstop.c
+++ b/src/s6-frontend/process_startstop.c
@@ -28,7 +28,7 @@ static void process_startstop (char const *const *argv, int h, char const *usage
{
{ .so = 'P', .lo = "no-permanent", .clear = GOLB_PERMANENT, .set = 0 },
{ .so = 'p', .lo = "permanent", .clear = 0, .set = GOLB_PERMANENT },
- { .so = 'W', .lo = "nowait", .clear = GOLB_WAIT, .set = 0 },
+ { .so = 'W', .lo = "no-wait", .clear = GOLB_WAIT, .set = 0 },
{ .so = 'w', .lo = "wait", .clear = 0, .set = GOLB_WAIT },
} ;
static gol_arg const rgola[] =
diff --git a/src/s6-frontend/repository.help.txt b/src/s6-frontend/repository.help.txt
new file mode 100644
index 0000000..91e14f7
--- /dev/null
+++ b/src/s6-frontend/repository.help.txt
@@ -0,0 +1 @@
+This is the repository help message.
diff --git a/src/s6-frontend/repository_help.c b/src/s6-frontend/repository_help.c
deleted file mode 100644
index 683e064..0000000
--- a/src/s6-frontend/repository_help.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include "s6-frontend-internal.h"
-
-#define REPOSITORY_HELP_MESSAGE "This is the live help message.\n"
-
-void repository_help (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, REPOSITORY_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
diff --git a/src/s6-frontend/s6-frontend.c b/src/s6-frontend/s6-frontend.c
index 30e6ef2..cb9835c 100644
--- a/src/s6-frontend/s6-frontend.c
+++ b/src/s6-frontend/s6-frontend.c
@@ -53,14 +53,14 @@ int main (int argc, char const *const *argv)
{
{ .so = 'h', .lo = "help", .clear = 0, .set = GOLB_HELP },
{ .so = 'V', .lo = "version", .clear = 0, .set = GOLB_VERSION },
- { .so = 0, .lo = "user", .clear = 0, .set = GOLB_USER },
+// { .so = 0, .lo = "user", .clear = 0, .set = GOLB_USER },
} ;
static gol_arg const rgola[] =
{
{ .so = 's', .lo = "scandir", .i = GOLA_SCANDIR },
{ .so = 'l', .lo = "livedir", .i = GOLA_LIVEDIR },
{ .so = 'r', .lo = "repodir", .i = GOLA_REPODIR },
- { .so = 'b', .lo = "bootdb", .i = GOLA_BOOTDB },
+ { .so = 'c', .lo = "bootdb", .i = GOLA_BOOTDB },
{ .so = 0, .lo = "stmpdir", .i = GOLA_STMPDIR },
{ .so = 'v', .lo = "verbosity", .i = GOLA_VERBOSITY },
{ .so = 0, .lo = "color", .i = GOLA_COLOR },
@@ -130,8 +130,8 @@ int main (int argc, char const *const *argv)
if (!force_color) g->color = g->istty ;
}
- g->isuser = !!(wgolb & GOLB_USER) ;
- if (g->isuser) s6f_user_get_confdirs(&g->dirs, &g->userstorage) ;
+// g->isuser = !!(wgolb & GOLB_USER) ;
+// if (g->isuser) s6f_user_get_confdirs(&g->dirs, &g->userstorage) ;
if (!*argv) dieusage() ;
cmd = BSEARCH(struct command_s, *argv, commands) ;
diff --git a/src/s6-frontend/set.help.txt b/src/s6-frontend/set.help.txt
new file mode 100644
index 0000000..3876309
--- /dev/null
+++ b/src/s6-frontend/set.help.txt
@@ -0,0 +1 @@
+This is the set help message.
diff --git a/src/s6-frontend/set_help.c b/src/s6-frontend/set_help.c
deleted file mode 100644
index 27715a1..0000000
--- a/src/s6-frontend/set_help.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include "s6-frontend-internal.h"
-
-#define SET_HELP_MESSAGE "This is the set help message.\n"
-
-void set_help (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, SET_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
diff --git a/src/s6-frontend/system.help.txt b/src/s6-frontend/system.help.txt
new file mode 100644
index 0000000..3e0af51
--- /dev/null
+++ b/src/s6-frontend/system.help.txt
@@ -0,0 +1 @@
+This is the system help message.
diff --git a/src/s6-frontend/system_help.c b/src/s6-frontend/system_help.c
deleted file mode 100644
index 0c50f42..0000000
--- a/src/s6-frontend/system_help.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/strerr.h>
-
-#include "s6-frontend-internal.h"
-
-#define SYSTEM_HELP_MESSAGE "This is the system help message.\n"
-
-void system_help (char const *const *argv)
-{
- (void)argv ;
- if (!buffer_putsflush(buffer_1, SYSTEM_HELP_MESSAGE))
- strerr_diefu1sys(111, "write to stdout") ;
- _exit(0) ;
-}
diff --git a/tools/help2c.sh b/tools/help2c.sh
new file mode 100755
index 0000000..5ce89e3
--- /dev/null
+++ b/tools/help2c.sh
@@ -0,0 +1,28 @@
+#!/bin/sh -e
+
+if test -z "$1" ; then
+ echo "$0: usage: $0 name < textfile > cfile" 1>&2
+ exit 1
+fi
+
+echo '/* ISC license. */'
+echo
+echo '#include <unistd.h>'
+echo
+echo '#include <skalibs/buffer.h>'
+echo '#include <skalibs/strerr.h>'
+echo
+echo '#include "s6-frontend-internal.h"'
+echo
+echo "void ${1}_help (char const *const *argv)"
+echo '{'
+echo " static char const *const ${1}_help_message ="
+
+sed 's/"/\\"/g; s/^/ "/; s/$/\\n"/'
+
+echo ' ;'
+echo " if (!buffer_putsflush(buffer_1, ${1}_help_message))"
+echo ' strerr_diefu1sys(111, "write to stdout") ;'
+echo ' (void)argv ;'
+echo ' _exit(0) ;'
+echo '}'