simple-init

A set of init binaries for linux
git clone git://depsterr.com/git/simple-init
Log | Files | Refs | README | LICENSE

commit 5be668375f65dbc9af9c880029528e6002b8dd77
parent 3e282c51f437b6dc5a9cc27444716edb199e530b
Author: depsterr <depsterr@protonmail.com>
Date:   Sun, 31 May 2020 18:08:11 +0200

added info to readme

Diffstat:
MREADME.md | 12+++++++++---
Minitscripts/util.h | 3---
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -2,9 +2,7 @@ These are some linux init "scripts" written in C. The scripts are heavily inspired by [the kisslinux init scripts](https://github.com/kisslinux/init). However, unlike the kiss init scripts, my init script doesn't: -* support mdev - -* drop you into a shell if anything goes wrong (good luck) +* support mdev (though you could easily change this yourself) * read options from rc.conf @@ -14,6 +12,14 @@ The boot init script currently works. Though it doesn't read sysctl settings yet The shutdown script is not yet implemented. +## Services and custom startup programs + +Just add them in `init.c` with a call to `spawn_process`, though beware of the following: + +* Any process called by `spawn_process` which does not exit sucessfully (with an error code of 0) will cause `wait_for_children` to drop the user into a shell. + +* If your process doesn't exit into the background `wait_for_children` will halt init. To work around this, create a shellscript which starts and disowns processes that you wish to start and then exits with code 0. Then execute this file instead. + ## Installation If you can't figure this out on your own, then you should not try to install anything here. diff --git a/initscripts/util.h b/initscripts/util.h @@ -1,8 +1,5 @@ #include <sys/wait.h> -int status = 0; -#define WAIT_FOR_CHILDREN while(wait(&status) > 0) - void wait_for_children(); int spawn_process(char** argv);