summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 18:27:41 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 18:27:41 +0000
commit2fa0acdd248c006270010196ad02e530d8ab09ea (patch)
tree0c5f946f06a1c98d2a35c8eb350dc62d3e97a8ff
parentc1171b979c236ec2c486bc12e4866112a12b9a84 (diff)
downloads6-linux-init-2fa0acdd248c006270010196ad02e530d8ab09ea.tar.xz
Adapt to skalibs-2.10.0.0 and s6-2.10.0.0
-rw-r--r--INSTALL10
-rw-r--r--NEWS6
-rw-r--r--doc/index.html12
-rw-r--r--doc/upgrade.html15
-rw-r--r--package/info2
-rw-r--r--src/init/s6-linux-init-maker.c26
-rw-r--r--src/init/s6-linux-init-telinit.c3
-rw-r--r--src/init/s6-linux-init.c9
-rw-r--r--src/shutdown/s6-linux-init-shutdownd.c14
9 files changed, 64 insertions, 33 deletions
diff --git a/INSTALL b/INSTALL
index f65e0a8..1774fcd 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,11 +6,11 @@ Build Instructions
- A Linux-based system with a standard C development environment
- GNU make version 3.81 or later
- - skalibs version 2.9.3.0 or later: https://skarnet.org/software/skalibs/
- - execline version 2.6.1.1 or later: https://skarnet.org/software/execline/
- - s6 version 2.9.2.0 or later: https://skarnet.org/software/s6/
- - Optional: nsss version 0.0.2.2 or later: https://skarnet.org/software/nsss/
- - Optional: utmps version 0.0.3.2 or later: https://skarnet.org/software/utmps/
+ - skalibs version 2.10.0.0 or later: https://skarnet.org/software/skalibs/
+ - execline version 2.7.0.0 or later: https://skarnet.org/software/execline/
+ - s6 version 10.0.0.0 or later: https://skarnet.org/software/s6/
+ - Optional: nsss version 0.0.2.3 or later: https://skarnet.org/software/nsss/
+ - Optional: utmps version 0.0.3.3 or later: https://skarnet.org/software/utmps/
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 4c127ce..c919a37 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changelog for s6-linux-init.
+In 1.0.5.2
+----------
+
+ - Bugfixes.
+
+
In 1.0.5.1
----------
diff --git a/doc/index.html b/doc/index.html
index d9e9abb..81e7749 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -72,16 +72,16 @@ kernel command line </li>
<li> A Linux-based system with a standard C development environment </li>
<li> GNU make, version 3.81 or later </li>
<li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
-2.9.3.0 or later. It's a build-time requirement. It's also a run-time
+2.10.0.0 or later. It's a build-time requirement. It's also a run-time
requirement (for <a href="s6-linux-init-maker.html">s6-linux-init-maker</a>)
as well as a boot-time requirement (i.e. a run-time requirement for the
programs used when you boot a system created with
<a href="s6-linux-init-maker.html">s6-linux-init-maker</a>) if you link
against the shared version of the skalibs library. </li>
<li> <a href="//skarnet.org/software/execline/">execline</a> version
-2.6.1.1 or later. It is a build-time and boot-time requirement. </li>
+2.7.0.0 or later. It is a build-time and boot-time requirement. </li>
<li> <a href="//skarnet.org/software/s6/">s6</a> version
-2.9.2.0 or later. It is a build-time and boot-time requirement. </li>
+2.10.0.0 or later. It is a build-time and boot-time requirement. </li>
</ul>
<p>
@@ -92,10 +92,10 @@ against the shared version of the skalibs library. </li>
<li> If you're using <a href="https://www.musl-libc.org/">musl</a> and
want nsswitch-like functionality:
<a href="//skarnet.org/software/nsss/">nsss</a> version
-0.0.2.2 or later (build-time and boot-time) </li>
+0.0.2.3 or later (build-time and boot-time) </li>
<li> If you want secure utmp functionality:
<a href="//skarnet.org/software/utmps/">utmps</a> version
-0.0.3.2 or later (build-time and boot-time) </li>
+0.0.3.3 or later (build-time and boot-time) </li>
</ul>
<p>
@@ -115,7 +115,7 @@ all the other packages against the <em>static</em> version of libskarnet.
<ul>
<li> The current released version of s6-linux-init is
-<a href="s6-linux-init-1.0.5.1.tar.gz">1.0.5.1</a>. </li>
+<a href="s6-linux-init-1.0.5.2.tar.gz">1.0.5.2</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 ff58afe..afa96fb 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,21 @@
<h1> What has changed in s6-linux-init </h1>
+<h2> in 1.0.5.2 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
+dependency bumped to 2.10.0.0. </li>
+ <li> <a href="//skarnet.org/software/execline/">execline</a>
+dependency bumped to 2.7.0.0. </li>
+ <li> <a href="//skarnet.org/software/s6/">s6</a>
+dependency bumped to 2.10.0.0. </li>
+ <li> <a href="//skarnet.org/software/nsss/">nsss</a>
+optional dependency bumped to 0.0.2.3. </li>
+ <li> <a href="//skarnet.org/software/utmps/">utmps</a>
+optional dependency bumped to 0.0.3.3. </li>
+</ul>
+
<h2> in 1.0.5.1 </h2>
<ul>
diff --git a/package/info b/package/info
index a1011ec..14c665a 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-linux-init
-version=1.0.5.1
+version=1.0.5.2
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 f858e5f..1e6de62 100644
--- a/src/init/s6-linux-init-maker.c
+++ b/src/init/s6-linux-init-maker.c
@@ -125,20 +125,20 @@ static int container_crash_script (buffer *b, char const *data)
S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnp\n") >= 0 ;
}
-static int container_exit_script (buffer *b, char const *results)
+static int container_exit_script (buffer *b, char const *data)
{
- return put_shebang_options(b, "-S0")
+ (void)data ;
+ return put_shebang(b)
&& buffer_puts(b,
- EXECLINE_EXTBINPREFIX "ifelse -X { test $1 = halt }\n{\n "
- S6_EXTBINPREFIX "s6-envdir -- ") >= 0
- && buffer_puts(b, results) >= 0
- && buffer_puts(b, "\n "
- EXECLINE_EXTBINPREFIX "importas -D0 -- EXITCODE exitcode\n "
- EXECLINE_EXTBINPREFIX "exit $EXITCODE\n}\n"
- EXECLINE_EXTBINPREFIX "ifte -X\n { "
- S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnr }\n { "
+ S6_EXTBINPREFIX "s6-envdir -- " S6_LINUX_INIT_TMPFS "/" CONTAINER_RESULTS "\n"
+ EXECLINE_EXTBINPREFIX "multisubstitute\n{\n"
+ " importas -uD0 -- EXITCODE exitcode\n "
+ " importas -uDh -- HALTCODE haltcode\n}\n"
+ EXECLINE_EXTBINPREFIX "ifelse -X { test $HALTCODE = r } { "
+ S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnr }\n"
+ EXECLINE_EXTBINPREFIX "ifelse -X { test $HALTCODE = p } { "
S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnp }\n"
- "test $1 = reboot\n") >= 0 ;
+ EXECLINE_EXTBINPREFIX "exit $EXITCODE\n") >= 0 ;
}
static int s6_svscan_log_script (buffer *b, char const *data)
@@ -573,8 +573,8 @@ static inline void make_image (char const *base)
if (inns)
{
- auto_script(base, "run-image/" SCANDIR "/.s6-svscan/crash", &container_crash_script, "") ;
- auto_script(base, "run-image/" SCANDIR "/.s6-svscan/finish", &container_exit_script, S6_LINUX_INIT_TMPFS "/" CONTAINER_RESULTS) ;
+ auto_script(base, "run-image/" SCANDIR "/.s6-svscan/crash", &container_crash_script, 0) ;
+ auto_script(base, "run-image/" SCANDIR "/.s6-svscan/finish", &container_exit_script, 0) ;
auto_dir(base, "run-image/" CONTAINER_RESULTS, 0, 0, 0755) ;
auto_file(base, "run-image/" CONTAINER_RESULTS "/exitcode", "0\n", 2) ;
}
diff --git a/src/init/s6-linux-init-telinit.c b/src/init/s6-linux-init-telinit.c
index cf05a7e..3c8d3fe 100644
--- a/src/init/s6-linux-init-telinit.c
+++ b/src/init/s6-linux-init-telinit.c
@@ -7,6 +7,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
+#include <skalibs/exec.h>
#include <s6/config.h>
@@ -72,5 +73,5 @@ int main (int argc, char const *const *argv, char const *const *envp)
newargv[2] = 0 ;
}
- xpathexec_run(newargv[0], newargv, envp) ;
+ xexec_e(newargv, envp) ;
}
diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c
index c68d0f9..9e2d86e 100644
--- a/src/init/s6-linux-init.c
+++ b/src/init/s6-linux-init.c
@@ -21,6 +21,7 @@
#include <skalibs/sig.h>
#include <skalibs/env.h>
#include <skalibs/djbunix.h>
+#include <skalibs/exec.h>
#include <s6/config.h>
@@ -113,7 +114,7 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned
if (fd_copy(2, 1) == -1)
strerr_diefu1sys(111, "fd_copy stdout to stderr") ;
}
- xpathexec_r(childargv, envp, envlen, modifs, modiflen) ;
+ xmexec_fm(childargv, envp, envlen, modifs, modiflen) ;
}
int main (int argc, char const **argv, char const *const *envp)
@@ -131,7 +132,7 @@ int main (int argc, char const **argv, char const *const *envp)
if (getpid() != 1)
{
argv[0] = S6_LINUX_INIT_BINPREFIX "s6-linux-init-telinit" ;
- xpathexec_run(argv[0], argv, envp) ;
+ xexec_e(argv, envp) ;
}
{
@@ -253,7 +254,7 @@ int main (int argc, char const **argv, char const *const *envp)
size_t pathlen = path ? strlen(path) : 0 ;
pid_t pid ;
char fmtfd[2 + UINT_FMT] = "-" ;
- char const *newargv[6] = { S6_EXTBINPREFIX "s6-svscan", "-st0", fmtfd, "--", S6_LINUX_INIT_TMPFS "/" SCANDIR, 0 } ;
+ char const *newargv[5] = { S6_EXTBINPREFIX "s6-svscan", fmtfd, "--", S6_LINUX_INIT_TMPFS "/" SCANDIR, 0 } ;
char pathvar[6 + pathlen] ;
if (path)
{
@@ -284,6 +285,6 @@ int main (int argc, char const **argv, char const *const *envp)
if (fd_copy(2, 1) == -1)
strerr_diefu1sys(111, "redirect output file descriptor") ;
}
- xpathexec_r(newargv, newenvp, !!path, envmodifs.s, envmodifs.len) ;
+ xmexec_fm(newargv, newenvp, !!path, envmodifs.s, envmodifs.len) ;
}
}
diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c
index 5e681e1..b646b5c 100644
--- a/src/shutdown/s6-linux-init-shutdownd.c
+++ b/src/shutdown/s6-linux-init-shutdownd.c
@@ -43,6 +43,7 @@
#define DOTPREFIXLEN (sizeof(DOTPREFIX) - 1)
#define DOTSUFFIX ":XXXXXX"
#define DOTSUFFIXLEN (sizeof(DOTSUFFIX) - 1)
+#define CONTAINERDIR S6_LINUX_INIT_TMPFS "/" CONTAINER_RESULTS
#define USAGE "s6-linux-init-shutdownd [ -c basedir ] [ -g gracetime ] [ -C ] [ -B ]"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -160,6 +161,14 @@ static inline void prepare_stage4 (char const *basedir, char what)
int fd ;
char buf[512] ;
size_t sabase = satmp.len ;
+ if (inns)
+ {
+ char s[2] = { what, '\n' } ;
+ if (mkdir(CONTAINERDIR, 0755) < 0 && errno != EEXIST)
+ strerr_diefu1sys(111, "mkdir " CONTAINERDIR) ;
+ if (!openwritenclose_unsafe(CONTAINERDIR "/haltcode", s, 2))
+ strerr_diefu1sys(111, "write to " CONTAINERDIR "/haltcode") ;
+ }
unlink_void(STAGE4_FILE ".new") ;
fd = open_excl(STAGE4_FILE ".new") ;
if (fd == -1) strerr_diefu3sys(111, "open ", STAGE4_FILE ".new", " for writing") ;
@@ -174,9 +183,8 @@ static inline void prepare_stage4 (char const *basedir, char what)
|| (!nologger && buffer_puts(&b,
EXECLINE_EXTBINPREFIX "foreground { "
S6_EXTBINPREFIX "s6-svc -Xh -- " SCANPREFIX LOGGER_SERVICEDIR " }\n ") < 0)
- || buffer_puts(&b, S6_EXTBINPREFIX "s6-svscanctl -") < 0
- || buffer_put(&b, what == 'h' ? "s" : &what, 1) < 0
- || buffer_putsflush(&b, "b -- " SCANDIRFULL "\n}\n") < 0)
+ || buffer_puts(&b,
+ S6_EXTBINPREFIX "s6-svscanctl -b -- " SCANDIRFULL "\n}\n") < 0)
strerr_diefu2sys(111, "write to ", STAGE4_FILE ".new") ;
}
else