diff options
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/s6-linux-init-maker.c | 26 | ||||
-rw-r--r-- | src/init/s6-linux-init-telinit.c | 3 | ||||
-rw-r--r-- | src/init/s6-linux-init.c | 9 |
3 files changed, 20 insertions, 18 deletions
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) ; } } |