troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 63 forks source link

respect runstatedir option #112

Closed xhebox closed 6 years ago

xhebox commented 6 years ago

I except finit could use --runstatedir=/run rather thanCFLAGS="$CFLAGS -D_PATH_VARRUN=/run" to specific which dir should be monitored. This should be fairy easy, but i dont know how to do it with autotools.

troglobit commented 6 years ago

_PATH_VARRUN is defined in paths.h, which traditionally is defined as /var/run/, but many systems have moved to use a RAM disk for /run and symlink /var/run --> /run.

Finit currently has a lot of magic implemented to automatically detect this at runtime, changing that to a pre-runtime configure option is a lot of work. Why do you want this to be changed?

xhebox commented 6 years ago

Pidfile plugin is using it. I can not get it working even with a modified dbus pid path at the beginning. But it seems it works now, maybe i changed something carelessly when i was testing. I will reopen it i met it again.

And i do not want it to be a pre-runtime configure option actually. It's because setting this macro to /run seems working for me(now working without setting it).

troglobit commented 6 years ago

As a bit of a reference/history: I added GNU configure script support to Finit mostly just to ease cross-compiling, and simplify option parsing, because maintaining that in a pure Makefile was becoming a bit of a hassle. Most of the standard paths are a bit useless for a PID 1, which needs to be available from the root filesystem and as such use /, /etc, /lib, /sbin ...

... the /run migration, started by RedHat and Debian quite a few years ago, is a bit of a pain since GNU hasn't changed defaults in their header files. However, there are a few helper APIs in pid.c, pid.h and also the handy C API realpath() (man 3 realpath), which is already used in the pidfile plugin. All these can detect the actual path, without symlinks, to a PID file.

Hope that helps, good luck!