Useful for installing Dinit alongside eg Sys V init.
BUILD_SHUTDOWN=yes|no
Whether to build the "shutdown" (and "halt" etc) utilities. These are only useful
if dinit is the system init (i.e. the PID 1 process). You probably don't want this
- unless building for Linux.
+ unless building for Linux.
+SHUTDOWN_PREFIX=...
+ Name prefix for "shutdown", "halt" and "reboot" commands (if they are built). This affects
+ both the output, and what command dinit will execute as part of system shutdown.
+ If you want to install Dinit alongside another init system with its own shutdown/halt/reboot
+ commands, set this (for eg. to "dinit-").
USE_UTMPX=1|0
Whether to build support for manipulating the utmp/utmpx database via the related POSIX
functions. If not set to any value, support is enabled for certain systems automatically
Any options to enable run-time sanitizers or additional safety checks. This will be used
only when building tests. It can safely be left blank.
+
Running test suite
=-=-=-=-=-=-=-=-=-
Any test failures will abort the test suite run immediately.
+To run the integration tests:
+
+ make check-igr
+
+(The integration tests are more fragile than the unit tests, but give a better indication that
+Dinit will actually work correctly on your system).
+
In addition to the standard test suite, there is experimental support for fuzzing the control
protocol handling using LLVM/clang's fuzzer (libFuzzer). Change to the `src/tests/cptests`
directory and build the "fuzz" target:
STRIPOPTS ?= -s
ifeq ($(BUILD_SHUTDOWN),yes)
- SHUTDOWN=shutdown
+ SHUTDOWN=$(SHUTDOWN_PREFIX)shutdown
endif
dinit_objects = dinit.o load-service.o service.o proc-service.o baseproc-service.o control.o dinit-log.o \
fi
includes/mconfig.h: mconfig-gen
- ./mconfig-gen SBINDIR=$(SBINDIR) SYSCONTROLSOCKET=$(SYSCONTROLSOCKET) \
+ ./mconfig-gen SBINDIR=$(SBINDIR) SYSCONTROLSOCKET=$(SYSCONTROLSOCKET) SHUTDOWN_PREFIX=$(SHUTDOWN_PREFIX) \
$(if $(USE_UTMPX),USE_UTMPX=$(USE_UTMPX),) > includes/mconfig.h
mconfig-gen: mconfig-gen.cc ../mconfig
dinitcheck: dinitcheck.o options-processing.o
$(CXX) -o dinitcheck dinitcheck.o options-processing.o $(LDFLAGS)
-shutdown: shutdown.o
- $(CXX) -o shutdown shutdown.o $(LDFLAGS)
+$(SHUTDOWNPREFIX)shutdown: shutdown.o
+ $(CXX) -o $(SHUTDOWNPREFIX)shutdown shutdown.o $(LDFLAGS)
$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) -MMD -MP -Iincludes -Idasynq -c $< -o $@
install -d $(DESTDIR)$(SBINDIR)
install $(STRIPOPTS) dinit dinitctl dinitcheck $(SHUTDOWN) $(DESTDIR)$(SBINDIR)
ifeq ($(BUILD_SHUTDOWN),yes)
- ln -f $(DESTDIR)$(SBINDIR)/shutdown $(DESTDIR)$(SBINDIR)/halt
- ln -f $(DESTDIR)$(SBINDIR)/shutdown $(DESTDIR)$(SBINDIR)/reboot
+ ln -f $(DESTDIR)$(SBINDIR)/$(SHUTDOWN) $(DESTDIR)$(SBINDIR)/$(SHUTDOWNPREFIX)halt
+ ln -f $(DESTDIR)$(SBINDIR)/$(SHUTDOWN) $(DESTDIR)$(SBINDIR)/$(SHUTDOWNPREFIX)reboot
endif
clean:
log_flush_timer_t log_flush_timer;
// These need to be at namespace scope to prevent causing stack allocations when using them:
- constexpr auto shutdown_exec = literal(SBINDIR) + "/" + "shutdown";
+ constexpr auto shutdown_exec = literal(SBINDIR) + "/" + SHUTDOWN_PREFIX + "shutdown";
constexpr auto error_exec_sd = literal("Error executing ") + shutdown_exec + ": ";
}
cout << "\n// Constants\n";
cout << "constexpr static char SYSCONTROLSOCKET[] = " << stringify(vars["SYSCONTROLSOCKET"]) << ";\n";
cout << "constexpr static char SBINDIR[] = " << stringify(vars["SBINDIR"]) << ";\n";
+ cout << "constexpr static char SHUTDOWN_PREFIX[] = " << stringify(vars["SHUTDOWN_PREFIX"]) << ";\n";
cout << "\n#endif\n";
return 0;