summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-06-07 13:03:49 +0000
committerLaurent Bercot <ska@appnovation.com>2023-06-07 13:03:49 +0000
commitd6e214a83b361ff000d0d28952f836639896cd85 (patch)
treec13b90687c14563855e51935b95a3ad9d6c5b5f1
parent2a4e570485e8dee285843ca46f6dd6155972c437 (diff)
downloads6-linux-init-d6e214a83b361ff000d0d28952f836639896cd85.tar.xz
Add verbosity setting, prepare for 1.1.2.0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--INSTALL2
-rw-r--r--NEWS4
-rw-r--r--doc/index.html4
-rw-r--r--doc/upgrade.html6
-rw-r--r--package/info2
-rw-r--r--src/init/s6-linux-init-maker.c38
-rw-r--r--src/init/s6-linux-init.c37
7 files changed, 54 insertions, 39 deletions
diff --git a/INSTALL b/INSTALL
index df09122..8d8d158 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,7 +10,7 @@ Build Instructions
- Optional: nsss version 0.2.0.3 or later: https://skarnet.org/software/nsss/
- Optional: utmps version 0.1.2.1 or later: https://skarnet.org/software/utmps/
- execline version 2.9.3.0 or later: https://skarnet.org/software/execline/
- - s6 version 2.11.3.2 or later: https://skarnet.org/software/s6/
+ - s6 version 2.11.4.0 or later: https://skarnet.org/software/s6/
This software is Linux-specific. It will run on a Linux kernel,
version 2.6.32 or later. However, it should not be too hard to port to
diff --git a/NEWS b/NEWS
index b4ad36e..62281ae 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,11 @@
Changelog for s6-linux-init.
-In 1.1.1.2
+In 1.1.2.0
----------
- Bugfixes.
+ - New -v verbosity option to s6-l-i.
+ - To leverage it: new -V boot_verbosity option to s6-l-i-m.
In 1.1.1.1
diff --git a/doc/index.html b/doc/index.html
index a4d515d..bb56e15 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -82,7 +82,7 @@ against the shared version of the skalibs library. </li>
<li> <a href="//skarnet.org/software/execline/">execline</a> version
2.9.3.0 or later. It is a build-time and boot-time requirement. </li>
<li> <a href="//skarnet.org/software/s6/">s6</a> version
-2.11.3.2 or later. It is a build-time and boot-time requirement. </li>
+2.11.4.0 or later. It is a build-time and boot-time requirement. </li>
</ul>
<p>
@@ -110,7 +110,7 @@ want nsswitch-like functionality:
<ul>
<li> The current released version of s6-linux-init is
-<a href="s6-linux-init-1.1.1.2.tar.gz">1.1.1.2</a>. </li>
+<a href="s6-linux-init-1.1.2.0.tar.gz">1.1.2.0</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-linux-init/">s6-linux-init
git repository</a>:
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 8c5e25a..eab645e 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,13 +18,15 @@
<h1> What has changed in s6-linux-init </h1>
-<h2> in 1.1.1.2 </h2>
+<h2> in 1.1.2.0 </h2>
<ul>
<li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
dependency bumped to 2.13.2.0. </li>
+ <li> <a href="//skarnet.org/software/s6/">s6</a>
+dependency bumped to 2.11.4.0. </li>
<li> You should run <a href="s6-linux-init-maker.html">s6-linux-init-maker</a>
-again to take advantage of a minor bugfix. </li>
+again to take advantage of new features and minor bugfixes. </li>
</ul>
<h2> in 1.1.1.1 </h2>
diff --git a/package/info b/package/info
index 98ea727..4e8453e 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-linux-init
-version=1.1.1.2
+version=1.1.2.0
category=admin
package_macro_name=S6_LINUX_INIT
diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c
index d3b921d..584b0b7 100644
--- a/src/init/s6-linux-init-maker.c
+++ b/src/init/s6-linux-init-maker.c
@@ -26,7 +26,7 @@
#include "defaults.h"
#include "initctl.h"
-#define USAGE "s6-linux-init-maker [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] [ -f skeldir ] [ -R resourcelimits ] [ -C ] [ -B ] [ -S ] dir"
+#define USAGE "s6-linux-init-maker [ -V boot_verbosity ] [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] [ -f skeldir ] [ -R resourcelimits ] [ -C ] [ -B ] [ -S ] dir"
#define dieusage() strerr_dieusage(100, USAGE)
#define dienomem() strerr_diefu1sys(111, "stralloc_catb") ;
@@ -43,6 +43,7 @@ static char const *skeldir = S6_LINUX_INIT_SKELDIR ;
static unsigned int initial_umask = 0022 ;
static unsigned int timestamp_style = 1 ;
static unsigned int finalsleep = 3000 ;
+static unsigned int boot_verbosity = 1 ;
static int mounttype = 1 ;
static int console = 0 ;
static int logouthookd = 0 ;
@@ -239,47 +240,47 @@ static int sig_script (buffer *b, char const *option)
static inline int stage1_script (buffer *b, char const *data)
{
size_t sabase = satmp.len ;
+ char fmt[UINT_OFMT] ;
if (!put_shebang_options(b, "-S0")) return 0 ;
if (ressa.len)
{
if (buffer_puts(b, S6_EXTBINPREFIX "s6-softlimit -H ") < 0
|| buffer_put(b, ressa.s, ressa.len) < 0) goto err ;
}
- if (buffer_puts(b, S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init -c ") < 0
- || !string_quote(&satmp, robase, strlen(robase))) return 0 ;
- if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
+ if (buffer_puts(b, S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init -v ") < 0
+ || buffer_put(b, fmt, uint_fmt(fmt, boot_verbosity)) < 0
+ || buffer_puts(b, " -m 00") < 0
+ || buffer_put(b, fmt, uint_ofmt(fmt, initial_umask)) < 0
+ || buffer_puts(b, " -c ") < 0
+ || !string_quote(&satmp, robase, strlen(robase))
+ || buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
satmp.len = sabase ;
- {
- char fmt[UINT_OFMT] ;
- if (buffer_puts(b, " -m 00") < 0
- || buffer_put(b, fmt, uint_ofmt(fmt, initial_umask)) < 0) return 0 ;
- }
if (initial_path)
{
if (buffer_puts(b, " -p ") < 0
- || !string_quote(&satmp, initial_path, strlen(initial_path))) return 0 ;
- if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
+ || !string_quote(&satmp, initial_path, strlen(initial_path))
+ || buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
satmp.len = sabase ;
}
if (env_store)
{
if (buffer_puts(b, " -s ") < 0
- || !string_quote(&satmp, env_store, strlen(env_store))) return 0 ;
- if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
+ || !string_quote(&satmp, env_store, strlen(env_store))
+ || buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
satmp.len = sabase ;
}
if (slashdev)
{
if (buffer_puts(b, " -d ") < 0
- || !string_quote(&satmp, slashdev, strlen(slashdev))) return 0 ;
- if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
+ || !string_quote(&satmp, slashdev, strlen(slashdev))
+ || buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
satmp.len = sabase ;
}
if (initdefault)
{
if (buffer_puts(b, " -D ") < 0
- || !string_quote(&satmp, initdefault, strlen(initdefault))) return 0 ;
- if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
+ || !string_quote(&satmp, initdefault, strlen(initdefault))
+ || buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ;
satmp.len = sabase ;
}
if (mounttype == 2)
@@ -663,10 +664,11 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "c:u:G:1Lp:m:t:d:s:e:E:q:D:nNf:R:CBS", &l) ;
+ int opt = subgetopt_r(argc, argv, "V:c:u:G:1Lp:m:t:d:s:e:E:q:D:nNf:R:CBS", &l) ;
if (opt == -1) break ;
switch (opt)
{
+ case 'V' : if (!uint0_scan(l.arg, &boot_verbosity)) dieusage() ; break ;
case 'c' : robase = l.arg ; break ;
case 'u' : log_user = l.arg ; break ;
case 'G' : early_getty = l.arg ; break ;
diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c
index 3c160bf..a8d2b9b 100644
--- a/src/init/s6-linux-init.c
+++ b/src/init/s6-linux-init.c
@@ -30,7 +30,7 @@
#include "defaults.h"
#include "initctl.h"
-#define USAGE "s6-linux-init [ -c basedir ] [ -p initpath ] [ -s envdumpdir ] [ -m umask ] [ -d devtmpfs ] [ -D initdefault ] [ -n | -N ] [ -C ] [ -B ]"
+#define USAGE "s6-linux-init [ -v verbosity ] [ -c basedir ] [ -p initpath ] [ -s envdumpdir ] [ -m umask ] [ -d devtmpfs ] [ -D initdefault ] [ -n | -N ] [ -C ] [ -B ]"
#define dieusage() strerr_dieusage(100, USAGE)
#define BANNER "\n s6-linux-init version " S6_LINUX_INIT_VERSION "\n\n"
@@ -38,6 +38,7 @@
static int inns = 0 ;
static int nologger = 0 ;
static int notifpipe[2] ;
+static unsigned int verbosity = 1 ;
static inline char const *scan_cmdline (char const *initdefault, char const *const *argv, unsigned int argc)
{
@@ -60,7 +61,7 @@ static inline void wait_for_notif (int fd)
if (r < 0) strerr_diefu1sys(111, "read from notification pipe") ;
if (!r)
{
- strerr_warnw1x("s6-svscan failed to send a notification byte!") ;
+ if (verbosity) strerr_warnw1x("s6-svscan failed to send a notification byte!") ;
break ;
}
if (memchr(buf, '\n', r)) break ;
@@ -74,17 +75,23 @@ static void kbspecials (void)
if (inns) return ;
fd = open("/dev/tty0", O_RDONLY | O_NOCTTY) ;
if (fd < 0)
- strerr_warnwu2sys("open /dev/", "tty0 (kbrequest will not be handled)") ;
+ {
+ if (errno == ENOENT)
+ {
+ if (verbosity >= 2) strerr_warni1x("headless system detected") ;
+ }
+ else if (verbosity) strerr_warnwu2sys("open", " tty0 (kbrequest will not be handled)") ;
+ }
else
{
if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0)
- strerr_warnwu2sys("ioctl KDSIGACCEPT on ", "tty0 (kbrequest will not be handled)") ;
+ if (verbosity) strerr_warnwu2sys("ioctl KDSIGACCEPT on", " tty0 (kbrequest will not be handled)") ;
close(fd) ;
}
sig_block(SIGINT) ; /* don't panic on early cad before s6-svscan catches it */
if (reboot(RB_DISABLE_CAD) == -1)
- strerr_warnwu1sys("trap ctrl-alt-del") ;
+ if (verbosity) strerr_warnwu1sys("trap ctrl-alt-del") ;
}
static void opendevnull (void)
@@ -92,7 +99,7 @@ static void opendevnull (void)
if (open("/dev/null", O_RDONLY))
{ /* ghetto /dev/null to the rescue */
int p[2] ;
- strerr_warnwu1sys("open /dev/null") ;
+ if (verbosity) strerr_warnwu1sys("open /dev/null") ;
if (pipe(p) < 0) strerr_diefu1sys(111, "pipe") ;
close(p[1]) ;
if (fd_move(0, p[0]) < 0) strerr_diefu1sys(111, "fd_move to stdin") ;
@@ -118,7 +125,7 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned
close(0) ;
if (openb_read(tty))
{
- strerr_warnwu2sys("open ", tty) ;
+ if (verbosity) strerr_warnwu2sys("open ", tty) ;
opendevnull() ;
}
}
@@ -170,10 +177,11 @@ int main (int argc, char const **argv, char const *const *envp)
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "c:p:s:m:d:D:nNCB", &l) ;
+ int opt = subgetopt_r(argc, argv, "v:c:p:s:m:d:D:nNCB", &l) ;
if (opt == -1) break ;
switch (opt)
{
+ case 'v' : if (!uint0_scan(l.arg, &verbosity)) dieusage() ; break ;
case 'c' : basedir = l.arg ; break ;
case 'p' : path = l.arg ; break ;
case 's' : envdumpdir = l.arg ; break ;
@@ -201,13 +209,13 @@ int main (int argc, char const **argv, char const *const *envp)
}
else
{
- if (r) strerr_warnw1x("parent wrote to fd 3!") ;
+ if (r) if (verbosity) strerr_warnw1x("parent wrote to fd 3!") ;
close(3) ;
}
if (!slashdev && hasconsole && isatty(2 - nologger))
{
tty = ttyname(2 - nologger) ;
- if (!tty) strerr_warnwu2sys("ttyname std", nologger ? "err" : "out") ;
+ if (!tty) if (verbosity) strerr_warnwu2sys("ttyname std", nologger ? "err" : "out") ;
}
}
else if (hasconsole) allwrite(1, BANNER, sizeof(BANNER) - 1) ;
@@ -253,7 +261,7 @@ int main (int argc, char const **argv, char const *const *envp)
if (umount(S6_LINUX_INIT_TMPFS) == -1)
{
if (errno != EINVAL)
- strerr_warnwu1sys("umount " S6_LINUX_INIT_TMPFS) ;
+ if (verbosity) strerr_warnwu1sys("umount " S6_LINUX_INIT_TMPFS) ;
}
if (mount("tmpfs", S6_LINUX_INIT_TMPFS, "tmpfs", MS_NODEV | MS_NOSUID, "mode=0755") == -1)
strerr_diefu1sys(111, "mount tmpfs on " S6_LINUX_INIT_TMPFS) ;
@@ -270,10 +278,10 @@ int main (int argc, char const **argv, char const *const *envp)
strerr_diefu3sys(111, "copy ", fn, " to " S6_LINUX_INIT_TMPFS) ;
memcpy(fn + dirlen + 1, ENVSTAGE1, sizeof(ENVSTAGE1)) ;
if (envdir_internal(fn, &envmodifs, SKALIBS_ENVDIR_VERBATIM | SKALIBS_ENVDIR_NOCLAMP, '\n') == -1)
- strerr_warnwu2sys("envdir ", fn) ;
+ if (verbosity) strerr_warnwu2sys("envdir ", fn) ;
}
if (envdumpdir && !env_dump(envdumpdir, 0700, envp))
- strerr_warnwu2sys("dump kernel environment to ", envdumpdir) ;
+ if (verbosity) strerr_warnwu2sys("dump kernel environment to ", envdumpdir) ;
if (!nologger)
{
@@ -300,7 +308,8 @@ int main (int argc, char const **argv, char const *const *envp)
newenvp[0] = pathvar ;
}
if (nologger && pipe(notifpipe) < 0) strerr_diefu1sys(111, "pipe") ;
- if (tty && !slashdev && ioctl(2 - nologger, TIOCNOTTY) == -1) strerr_warnwu1sys("relinquish control terminal") ;
+ if (tty && !slashdev && ioctl(2 - nologger, TIOCNOTTY) == -1)
+ if (verbosity) strerr_warnwu1sys("relinquish control terminal") ;
pid = fork() ;
if (pid == -1) strerr_diefu1sys(111, "fork") ;