Define MODULES_LOAD_PATH only when it's unset, this allows it to be
overridden, for instance, by passing CFLAGS.
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
This patch makes the RTC plugin a bit more stand-alone, it is now also
back in the hands of the user to set a default timezone.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Most of the helper functions around TTYs assumed that STDIN_FILENO was
already set up and unique for the give TTY they operated on. It turns
out it wasn't. This patch refactors the open() of TTYs to ensure we
do not clobber our TTY settings with multiple calls to tcsetattr() for
the same TTY.
Took a while to track this one down. Usually I don't run systems with
more than one TTY, but the Alpine system on my home server did, and boy
I've never been this close to giving up on computers, ever.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
On Alpine Linux 3.6 the tcsetattr() calls failed. This turned out to be
a deeply rooted issue not limited to just musl libc. The workaround is
to call tcsetattr() in several rounds. In particular the modem signals,
c_cflag bits, always fail, so we take a bet on Linux having set up the
terminals (hope as a strategy) and ignore that problem, for now.
Also, use TCSAFLUSH with tcsetattr(), that seems to work better and is
what BusyBox stty use.
The local CTL() macro is replaced with CTL() from ttydefaults.h, which
exists also in musl libc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The svc_find_by_pidfile() function is called async from the pidfile
plugin, so by the time the queue is processed the origin may have
moved or been removed even. Safe to ignore.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch sets the TZ variable to a sane default, UTC. Fixing, at
least, the time restore problems of the RTC plugin.
Also, let the C library figure out DST, as the docs say -1 does ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When starting up a system booted from initramfs / may already be
mounted (read-only), so we can safely fsck it before proceeding
to remount it as read-write later (possibly).
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
In case we run into problems mounting /sys or /proc we should have
signals and the optional emergency shell available for recovery.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Unlike find(1), nftw(3) defaults to follow symlinks. For some kernel
configurations this turned out to be detrimental and caused the plugin
to loop forever scanning modalias files.
Also, check if /sys is mounted before even calling nftw().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch is a follow-up to the idea introduced in 1d6737e, but this
time we make sure to always append the svc ID to conditions if their
.conf has been declared with :ID
Meaning, the following .conf:
service :0 /sbin/teamd --config-file /etc/teamd-lag0.conf
service :1 /sbin/teamd --config-file /etc/teamd-lag0.conf
results in the following two conditions:
svc/sbin/teamd/0
svc/sbin/teamd/1
With a custom 'name:foo':
service name:lag :0 /sbin/teamd
service name:lag :1 /sbin/teamd
the resulting conditions look even prettier:
svc/lag/0
svc/lag/1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch makes the ':ID' field optional when registering non-inetd
run/taks/service etc. It has always been optional in the .conf files,
but internally we defaulted to ':1'.
To open up for more useful conditions we now default to zero/NULL :ID,
meaning the user now *must* keep track of the :ID field if they have
multiple services with the same name. This should already have been
an issue since such services would likely have conflicted with their
PID files (same name). So it's unlikely to affect any user severely.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When registering a service there is the option to set a custom PID file,
and even tell Finit to maintain that PID file in case the daemon doesn't
Until now there hasn't been a way to create custom conditions though ...
This patch leverages the new 'name:foo' argument to tas/run/services to
trigger condition 'svc/foo' (notice lack of path!) when a custom name is
set and either the default, or the custom, PID file is created.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch makes it possible to declare tty's using the magic keyword 'console',
an alias for the already existing '@console' keyword, which automatically detect
valid console(s) from the console=foo kernel command line.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The default runlevels are otherwise 2-5. Usually, however, when
debugging a system you may want to have runlevel 1 (single user
level) available to log in.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This is a more sane default, and also what systems expect, and what
other getty implementations support. I.e., unless specified, or set
to 0, the tty baud rate is zero -- which means do not change speed
at all.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The svc_find_by_pidfile() function may be called with "/run/./foo.pid",
or similar, which must be sanitized before being compared to the PID
file of each svc_t.
This patch introduce realpath() to untangle the paths and check if the
file actually exists.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Services may exist in multiple runlevels, i.e. one behavior at bootstrap
and another at runtime. If the user does not set a specific PID file to
be used as condition finit can match the wrong svc.
This patch extends svc_find_by_pidfile() to also compare the contents of
the PID file with the PID of the registered svc_t.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch removes the --enable-rw-rootfs build flag. Like OpenRC we
now check /etc/fstab instad; if `/` is listed *and* doesn't have the
`ro` flag set, we remount / read-write.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>