mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Add support for Finit specific tmpfiles.d/
The tmpfilesd() glob sorts files according to name, we could name our
.conf as 00finit.conf to prevent ordering issues with, e.g. dnsmasq,
but this is more elegant and allows for multi-level override.
NOTE: bootmisc depends on the pidfile plugins since the latter need
to set up its iwatches of /run before bootmisc creates /run.
Depending on if it's a system with /var/run or /run we need to
drop /var/run before recreating it.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -285,6 +285,10 @@ AC_EXPAND_DIR(tmpfiles_path, "$libdir/tmpfiles.d")
|
|||||||
AC_SUBST(tmpfiles_path)
|
AC_SUBST(tmpfiles_path)
|
||||||
AC_DEFINE_UNQUOTED(TMPFILES_PATH, "$tmpfiles_path", [Main tmpfiles.d/, override in /etc])
|
AC_DEFINE_UNQUOTED(TMPFILES_PATH, "$tmpfiles_path", [Main tmpfiles.d/, override in /etc])
|
||||||
|
|
||||||
|
AC_EXPAND_DIR(finit_tmpfiles, "$pkglibdir/tmpfiles.d")
|
||||||
|
AC_SUBST(finit_tmpfiles)
|
||||||
|
AC_DEFINE_UNQUOTED(FINIT_TMPFILES, "$finit_tmpfiles", [Finit tmpfiles.d/ .conf path])
|
||||||
|
|
||||||
AC_EXPAND_DIR(rescue_conf, "$pkglibdir/rescue.conf")
|
AC_EXPAND_DIR(rescue_conf, "$pkglibdir/rescue.conf")
|
||||||
AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
|
AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
|
||||||
AC_EXPAND_DIR(sample_conf, "$pkglibdir/sample.conf")
|
AC_EXPAND_DIR(sample_conf, "$pkglibdir/sample.conf")
|
||||||
|
|||||||
@@ -159,15 +159,6 @@ static void setup(void *arg)
|
|||||||
|
|
||||||
prev = umask(0);
|
prev = umask(0);
|
||||||
|
|
||||||
/*
|
|
||||||
* REQUIRED for compatibility with, e.g. _PATH_VARRUN!
|
|
||||||
* Should be set up by OS/dist, this is a fallback.
|
|
||||||
*/
|
|
||||||
if (fismnt("/run")) {
|
|
||||||
rmdir("/var/run");
|
|
||||||
ln("../run", "/var/run");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kernel symlinks, e.g. /proc/self/fd -> /dev/fd */
|
/* Kernel symlinks, e.g. /proc/self/fd -> /dev/fd */
|
||||||
kernel_links();
|
kernel_links();
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -439,11 +439,18 @@ static void tmpfiles(char *line)
|
|||||||
warn("Failed %s operation on path %s", type, path);
|
warn("Failed %s operation on path %s", type, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only the three last tmpfiles.d/ directories are defined in
|
||||||
|
* tmpfiles.d(5) as system search paths. Finit adds two more
|
||||||
|
* before that to have Finit specific ones sorted first, and
|
||||||
|
* a configure prefix specific one after that for user needs.
|
||||||
|
*/
|
||||||
void tmpfilesd(void)
|
void tmpfilesd(void)
|
||||||
{
|
{
|
||||||
/* in priority order */
|
/* in priority order */
|
||||||
char *dir[] = {
|
char *dir[] = {
|
||||||
TMPFILES_PATH "/*.conf", /* Finit specific, not in tmpfiles.d(5) */
|
FINIT_TMPFILES "/*.conf",
|
||||||
|
TMPFILES_PATH "/*.conf",
|
||||||
"/usr/lib/tmpfiles.d/*.conf",
|
"/usr/lib/tmpfiles.d/*.conf",
|
||||||
"/run/tmpfiles.d/*.conf",
|
"/run/tmpfiles.d/*.conf",
|
||||||
"/etc/tmpfiles.d/*.conf", /* local admin overrides */
|
"/etc/tmpfiles.d/*.conf", /* local admin overrides */
|
||||||
@@ -477,6 +484,7 @@ void tmpfilesd(void)
|
|||||||
if (!fp)
|
if (!fp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// info("Parsing %s ...", fn);
|
||||||
while (!feof(fp)) {
|
while (!feof(fp)) {
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
finitdir = $(finit_tmpfiles)
|
||||||
|
dist_finit_DATA = finit.conf
|
||||||
|
|
||||||
tmpfilesdir = $(tmpfiles_path)
|
tmpfilesdir = $(tmpfiles_path)
|
||||||
dist_tmpfiles_DATA = etc.conf legacy.conf var.conf x11.conf
|
dist_tmpfiles_DATA = etc.conf legacy.conf var.conf x11.conf
|
||||||
dist_tmpfiles_DATA += dnsmasq.conf frr.conf lldpd.conf openswan.conf \
|
dist_tmpfiles_DATA += dnsmasq.conf frr.conf lldpd.conf openswan.conf \
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Finit expects to run on a Linux FHS compatible system.
|
||||||
|
# Preferably one where /run is used and is a RAM disk.
|
||||||
|
|
||||||
|
# This should be set up but OS/dist but is sometimes missing
|
||||||
|
# Note: l+ == only if ../run exists, if so, rm -rf /var/run
|
||||||
|
l+ /var/run - - - - ../run
|
||||||
|
|
||||||
|
# Finit directories
|
||||||
|
d /run/finit 0755 - - -
|
||||||
|
d /run/finit/cond 0755 - - -
|
||||||
|
d /run/finit/cond/pid 0755 - - -
|
||||||
|
d /run/finit/cond/sys 0755 - - -
|
||||||
|
d /run/finit/cond/usr 0755 - - -
|
||||||
|
|
||||||
Reference in New Issue
Block a user