Revert crazy BANNER macro idea from 5ba7bc1. It is simply too difficult to
set -DBANNER='"Some distributions specific text"' in a parent Makefile
without entering Shell/Make escape hell ... instead, downstream will
have to patch the banner() function.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
On some platforms GCC does not zero the heap. This can lead to
serious problems, e.g., tty->pid may be non-zero while never
having been started.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Standard init implementations save current and previous runlevels
in utmp, now finit does too. Also, the initial runlevel at boot
has changed from 10 to the more obvious 0.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for runlevels to tty command and support for reading baud
rate and TERM variable from finit.conf.
The tty-watcher thread has been converted to a standard I/O plugin.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Most systems need an early bootstrap phase for one-shot tasks and
necessary one-time probing. This phase usually runs well before any
networking is setup. This commit adds support for that 'S' runlevel,
and also extends the number of possible total runlevels to nine.
For the one-shot tasks that run in bootstrap two new finit.conf cmds
have been added:
- task: For one-shot tasks that can be started in parallell
- run: For one-shot tasks that must run in sequence
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is a refactor of how arguments to finit.conf file settings
are parsed. Not all settings are run directly, but only need the arg
for future use. The code should be a lot easier to understand now.
Also, added support for specifying the desired runlevel in finit.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
chomp():
Removed first \n instead of last \n
set_hostname():
If /etc/hostname exists we need to realloc the size of
the current hostname variable. Also, only try to set
the hostname if !NULL
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The ROOTDIR variable was only set in the top-level Makefile,
so when building from a subdirectory the output was slightly
garbled. Moved ROOTDIR declaration to common.mk.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Remove indentation of module loading and device node creation
- Clarify that we load kernel modules
- Clarify that we load Finit plugins
- Remove cls()
- Remove verbose condition for echo()
- Make banner a separate function with optional distribution banner
- Add a few neat ANSI escape sequences for cls(), clreol(), delline(), etc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
More inspiration and courage from the launchd Google Talk video!
Fascinating stuff about replacing init/inetd/cron/watchdogd that
I've been thinking about for ages!
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit adds a line: "Loading kernel modules ..." before increasing
indentation level of module loading messages.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit adds support for -d, --debug option to init, which can
be used to toggle the finit debug mode at runtime.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Like most other init implementations do, when entering runlevel 1, finit
creates the file /etc/nologin to prevent users from logging in during
single-user mode, this file is then removed upon leaving runlevel 1.
Also, bugfix how FIFO I/O plugins are handled in finit. A FIFO will
need to be reopened by the server side when the client closes the pipe.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit adds support for specifying TTY and console to be used
for starting a getty to login to the system
Add the following to your finit.conf to use this feature:
tty ttyS0
tty ttyUSB0
console ttyS0
Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit adds a statistics counter to the finit svc_t process struct
which is incremented every time a process is restarted by the service
monitor.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch reorders the shutdown/reboot handler slightly and fixes
a bug in sleep(). It seems the sleep() syscall was interrupted by
receiving lots of SIGCHLD. Unsurprisingly since we just sent all
processes SIGTERM, but unfortunate since that was too short time
to deliver SIGTERM to watchdogd.
We now call sleep() again, as long as it returns a non-zero value,
until at most two (2) seconds have passed. During this time we
basically pend for watchdogd to do its job and let the WDT reboot
the system. If the two second timeout passes we send SIGKILL and
forcibly reboot(RB_AUTOBOOT) the system.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When using the simple rsync() or copyfile() functions of libite some
error codes should not be interpreted as error. I.e., if a file or
directory already exists when attempting to create it.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The ROOTDIR variable is used for pretty formatting during compilation.
Some users might want to have this display the build from the top of
their tree instead of the finit build tree.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This also adds support for monitor /dev for TTYs appering after boot,
USB-to-serial converters for example.
Some limitations: Baudrate (and other settings) is hardcoded for now,
should be read from config file.