Matthias Kruk [Mon, 22 Mar 2021 00:36:25 +0000 (09:36 +0900)]
include/log: Add logging facilities
This commit adds the log module which can be adopted by scripts to log
messages to log files that are stored in TOOLBOX_HOME. The module also
provides convenience functions for highlighting output and printing
stack traces.
In certain situations, mutex are not enough for synchronization. This
commit adds a POSIX-like semaphore implementation that can be used to
implement things like queues or singleton scripts.
Scripts that access shared resources need a means to synchronize accesses
to those resources. This commit adds a symlink-based mutex implementation
that can be used for this purpose.
Matthias Kruk [Sat, 20 Mar 2021 23:23:32 +0000 (08:23 +0900)]
toolbox: Implement toolbox initialization and module loading
When writing shell scripts, I often find myself copying or rewriting
functions because bash does not provide a mechanism to easily reuse
code. This commit adds a mechanism for loadable bash "modules".